By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,717 Members | 2,069 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,717 IT Pros & Developers. It's quick & easy.

Fixed Column in Grid View

P: 1
hi
Please help me i want to fix a column in grid view i used style for locking the
column since i am setting the position as relative its not working properly
i have given my code below could any body fix this issue

Expand|Select|Wrap|Line Numbers
  1. <style type="text/css">
  2. /* Div container to wrap the datagrid */
  3. div#div-datagrid 
  4. {
  5. width: 700px;
  6. overflow-x: auto;
  7. overflow-y: hidden;
  8. overflow: -moz-scrollbars-vertical;
  9. scrollbar-base-color:#ffeaff;
  10. }
  11.  
  12. /* Locks the left column */
  13. td.locked, th.locked {
  14. position:relative;
  15. cursor: default;
  16. /*IE5+ only*/
  17.  
  18. left: expression(document.getElementById("div-datagrid").scrollLeft-2);
  19. }
  20.  
  21. /* DataGrid Item and AlternatingItem Style*/
  22. .GridRow {font-size: 10pt; color: black; font-family: Arial; 
  23.              background-color:#ffffff; height:35px;}
  24. .GridAltRow {font-size: 10pt; color: black; font-family: Arial; 
  25.              background-color:#eeeeee; height:35px;}</PRE>         
  26.  
  27. </style>
  28.  
  29. <html>
  30. <div id="div-datagrid" >
  31.              <asp:GridView ID="GridView1" PagerSettings-Visible="false"   runat="server" CellPadding="4" ForeColor="#333333" 
  32.                      AllowSorting="True" AutoGenerateColumns="False"   PageSize="7" AllowPaging="true"
  33.                         DataKeyNames="ClientId"  OnRowDataBound="GridView1_RowDataBound" >
  34.                  <AlternatingRowStyle CssClass= "GridAltRow"/>
  35.                 <RowStyle CssClass= "GridRow"/>
  36.                     <Columns>
  37.                          <asp:BoundField DataField="ClientId" HeaderText="ClientId" InsertVisible="False"
  38.                     ReadOnly="True" SortExpression="ClientId" />
  39.                 <asp:BoundField DataField="EnterpriseUserName"  />
  40. <column>
  41. </DataGrid>
  42. </Html>
and in code behind i called the rowbound event

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
e.Row.Cells[0].CssClass = "locked";
}



Is there is any other solution Please
Nov 23 '07 #1
Share this Question
Share on Google+
4 Replies


Expert 100+
P: 487
You have to explain below queries
What is your front end?
What version is that?
What is the error you are getting?
Peoples are not here to simply fix your problem, you have to try.
Nov 23 '07 #2

P: 9
Try using "Frozen" property Or "Read only" property can be set to true for that column.
Nov 23 '07 #3

Expert 100+
P: 487
I think she never mean read-only column!
Read-only column! = Fixed column.
Nov 27 '07 #4

Shashi Sadasivan
Expert 100+
P: 1,435
Hi,
Welcome to TSDN

Please remember to provide a meaningful Title for any threads started (see the FAQ entry Use a Good Thread Title).

This helps to ensure that other members, and also the general public, will have a better chance of finding answers to any similar questions.
Nov 27 '07 #5

Post your reply

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