Click here to Skip to main content
16,004,806 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
want to freeze the datagridview first 3 columns of 8 columns using css. please assist.
Posted
Comments
[no name] 20-Aug-14 15:47pm    
http://forums.asp.net/t/1120278.aspx?GridView+Freezing+First+Columns+and+Freezing+Column+s+Headers
Sergey Alexandrovich Kryukov 20-Aug-14 15:48pm    
CSS does not work with DataGridView; the class with such name is System.Windows.Forms.DataGridView, totally unrelated to ASP.NET. Sorry, you confused something.
Now, CSS can only be related to the HTML elements, such as <table>. Also, it's not clear what do you mean by "freezing"/ It could be "freezing" from scrolling (a popular question), or just read-only...
—SA
Ashi0891 22-Aug-14 7:09am    
https://www.google.com/search?newwindow=1&site=&source=hp&q=freeze+datagridview+columns+using+css&oq=freeze+datagridview+columns+using+css&gs_l=hp.3..0i22i30.852.9697.0.9915.37.31.0.3.3.0.268.4537.0j18j6.24.0....0...1c.1.51.hp..13.24.3983.fFiliQxL5NM
You should have visited this link before posting this question.
kirubakaran3@yahoo.co.in 29-Aug-14 15:15pm    
I tried adding css property. it dint work. See the code below

Css file :
.FrozenCell
{
position: relative;
}
Aspx page :
<asp:TemplateField HeaderText="Name" SortExpression="Name" HeaderStyle-CssClass="FrozenCell" ItemStyle-CssClass="FrozenCell">

Pls help

1 solution

Here are some articles which will help you to freeze gridview columns using CSS:

The Freeze Pane DataGrid[^]
Fixed Table Header atop scrollable GridView in ASP.NET[^]
freeze-aspnet-gridview-columns-and.html[^]

and also Few similar forms you may want to have a look at:

freeze-asp-net-grid-view-column[^]
Freezing+the+column+header+row+of+a+GridView+control+using+CSS+[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900