473,888 Members | 1,599 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Fixed Column in Grid View

1 New Member
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. }
  12. /* Locks the left column */
  13. td.locked, th.locked {
  14. position:relative;
  15. cursor: default;
  16. /*IE5+ only*/
  18. left: expression(document.getElementById("div-datagrid").scrollLeft-2);
  19. }
  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>         
  27. </style>
  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_RowDa taBound(object sender, GridViewRowEven tArgs e)
e.Row.Cells[0].CssClass = "locked";

Is there is any other solution Please
Nov 23 '07 #1
4 1849
487 Recognized Expert Contributor
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
9 New Member
Try using "Frozen" property Or "Read only" property can be set to true for that column.
Nov 23 '07 #3
487 Recognized Expert Contributor
I think she never mean read-only column!
Read-only column! = Fixed column.
Nov 27 '07 #4
Shashi Sadasivan
1,435 Recognized Expert Top Contributor
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

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

Similar topics

by: Fernando Lopes | last post by:
Hi. Anybody know how can i add a column with radio buttons in a grid view? I will use this column to select the grid row to show others informations about this selected row. Any help will be appreciate. Thanks. Fernando Lopes
by: Joe Griffith | last post by:
I'm using a Win Forms Data Grid View control in unbound mode. When I add columns using the wizard the first item is the column name. Everything works fine. However, if you return to the columns collection and look at the poperties of an individual column the name property is not in the list. Is there a way to change (or even find) the name of a column in a data grid view other than looking at it in the *.Designer.vb file?
by: Otie | last post by:
Hello, I am using the MSFlexGrd Control in VB5. I have 1 fixed row and one fixed column. I am trying to do a sort when the user clicks a column in the FIXED ROW. But when I capture the row number in the click event I get row = 1 if I click on the FIXED row OR the actual row 1. How can I get the grid control to tell me when the user has clicked on the FIXED row and not on row 1 (since they both produce row = 1 and I cannot tell them apart...
by: Gunawan | last post by:
Hi, I could add a boundcolumn to gridview using this BoundColumn bc = new BoundColumn(); bc.DataField = "ProductsName"; bc.HeaderText = "Product"; gridview1.columns.add(bc); What I would like to ask, how can I perform this with TemplateColumn? I have a problem to bound template column to any object such as dropdownlist
by: Valli | last post by:
Hi, I am using a gridview to display data from table. In the gridview, there are 5 columns in which one column contains link name(eg. http://www.msn.com). I want to show this link as an hyperlink & when the user click the link, the browser should open the link page. Can anyone explain how to add an hyperlink column & when it got clicked it should get transferered to the selected web page. The link page differs for each record in grid...
by: jakeesgirl | last post by:
I'm creating a C# program in Visual Studio. When I query the sql database, the results are put into a data grid view. However, the column widths are always too small when displayed. I have text that is not shown because the column width is not large enough. Is there a way I can fix that in the data grid view? I see a column height property but not a column width.
by: rameshgohil | last post by:
I am using grid view and a button column in it using <itemTemplate> but I am not able to rerive cell value of a selected row from grid view. I have tried the following to methods in Row_command event of gridview but it gives Null reference exception error while clicking the button in button column of grid view : int index = gdvOdetails.SelectedIndex; object oid = (object)gdvOdetails.SelectedDataKey.Values; txtMsg.Text =...
by: rogerford | last post by:
I have a grid which i bind with values from Database. I have events to edit and update the grid. I am not using SqlDatasource to connect to DB. Rather i am doing the updating of the grid Programmatically. I have 3 columns, LID(item template column) ,LVal (Edit Item template column) and Edit link My Question: 1) My EditITemTemplate column has a textbox txt_Lval which does not show up on the page load. But if click on edit link that...
by: vinod allapu | last post by:
Hi all, i want to append an empty column to the grid view. Only the appended column should be editable and while displaying the grid the entire column should be in editable mode(not a single cell) . so that the user can enter values in that column and update. My grid should not contain any edit,update buttons. Please check the image for better understanding. Is it possible to do like this... Thanking you all,
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.