473,549 Members | 2,627 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to freeze first column of each row in gridview?

45 New Member
Hi All,


I am trying freez first column of each row in gridview using Css but it is not working.


Expand|Select|Wrap|Line Numbers
  1. <link href="Includes/Styles1.css" rel="stylesheet" type="text/css" />
  2.  
  3.     <title>Untitled Page</title>
  4.     <style type="text/css">
  5.         div#div-datagrid
  6.         {
  7.             width: 220px;
  8.             height: 100px;
  9.             overflow: auto;
  10.             scrollbar-base-color: #ffeaff;
  11.         }
  12.         /* Locks the left column */td.locked, th.locked
  13.         {
  14.             font-size: 14px;
  15.             font-weight: bold;
  16.             text-align: center;
  17.             background-color: navy;
  18.             color: white;
  19.             border-right: 1px solid silver;
  20.             position: relative;
  21.             cursor: default; /*IE5+ only*/
  22.             left: expression(document.getElementById(  "div-datagrid" ).scrollLeft-2);
  23.         }
  24.  
  25.  
  26.         /* Locks table header */th
  27.         {
  28.             font-size: 14px;
  29.             font-weight: bold;
  30.             text-align: center;
  31.             background-color: navy;
  32.             color: white;
  33.             border-right: 1px solid silver;
  34.             position: relative;
  35.             cursor: default; /*IE5+ only*/
  36.             top: expression(document.getElementById(  "div-datagrid" ).scrollTop-2);
  37.  
  38.             z-index: 5;
  39.         }
  40.         /* Keeps the header as the top most item. Important for top left item*/th.locked
  41.         {
  42.             z-index: 99;
  43.         }
  44.         /* DataGrid Item and AlternatingItem Style*/.GridRow
  45.         {
  46.             font-size: 10pt;
  47.             color: black;
  48.             font-family: Arial;
  49.             background-color: #ffffff;
  50.             height: 35px;
  51.         }
  52.         .GridAltRow
  53.         {
  54.             font-size: 10pt;
  55.  
  56.             color: black;
  57.  
  58.             font-family: Arial;
  59.             background-color: #eeeeee;
  60.             height: 35px;
  61.         }
  62.     </style>
  63. </head>
  64. <body>
  65.     <form id="form1" runat="server">
  66.     <div id="div-datagrid">
  67.         <asp:GridView  ID="GridView1" runat="server" 
  68.             onrowdatabound="GridView1_RowDataBound1" 
  69.             onselectedindexchanged="GridView1_SelectedIndexChanged">
  70.         </asp:GridView>
  71.     </div>
  72.     </form>
  73. </body>
Feb 2 '11 #1
0 2348

Sign in to post your reply or Sign up for a free account.

Similar topics

3
6385
by: Ken | last post by:
Is it possible to freeze a column/field on a continuous form? Ken
3
7173
by: Jason | last post by:
How do I hide a column in a GridView in ASP.NET 2.0 when all of the columns are autogenerated based on the datasource? I want to hide the first of three columns, but the following doesn't work: DataTable dt = new DataTable(); DataColumn dc; dc = new DataColumn(); dc.ColumnName = "blog_entry_id"; dc.DataType =...
2
4705
by: denvercr | last post by:
Hi guys, I'm having a problem on this a couple of days ago.. I did the best I could but I end up nothing. you guys are my last resort.. How could I possibly retrieve a value of a hidden column in gridview? The column that is hidden is the primary key for security issue.. Hope you could help me out of this guys.. thanks for your good...
1
5811
by: Waseem | last post by:
As we know in Excel sheet we can freeze some column or header likewise in Vb6.0 Iam trying to assign some headers in my applications like a report header i.e., when ever a next page is clicked the same header should be displayed. Can anyboby help me out how to do it programmatically. Thank U
2
1941
by: neoret | last post by:
Hello. I need some help on how to add a radiobutton to every row in the first column in a datagrid. The datasource to the datagrid is a dataTable. I loop through this table to add rows and just need to find the right way to add a radiobutton for each row... I need the radio buttons to be grouped so that only one can be selected
2
3038
by: Mariano | last post by:
Greetings, pls help me friends...somebody knows how could I see the value of a cell belong to invisible column in gridview? I have a table with fields like that : name, last name, address. I show in grid view name and last name but address is invisble, how i see the value of these cells in a rowdatabound event? Thanks a lot, Mariano
5
11315
by: Localbar | last post by:
Anyone have idea how to do that? Thanks a lot Localbar
1
7140
by: Valli | last post by:
Hi, I need to display an hyperlink column in gridview where if the user clicks that column the page should move to the selected page. I have got help from this group & started using template field. After using this, I couldnt see a column supporting hyperlink. In the gridviews first column header, there appears an hyperlink with the first...
1
1525
by: rajkumarWaits | last post by:
I have a requirement of freezing the first column of the datagrid. I was able to achieve it via CSS. Problem is, I have a dropdown in the grid which comes above the frozen column. Since dropdown is a windowed control it paints themselves on top of all controls in the page. Is there any workaround for this issue?
1
4484
by: olgagjor | last post by:
how can i change column in gridview with css in visual studio 2005. my table has 5 rows and 4 columns.if i want to change 3 rd column can i change entire column or i must change separately. because i want to create class for properties for the column. did i have to put class in every <td class =""> for that column or i can change entire column.
0
7521
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7451
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7720
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7959
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
5369
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3501
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3483
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1061
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
764
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.