Click here to Skip to main content
16,004,782 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to freeze the datagridview first 3 columns of 8 columns.
I've tried it using css.

Css file :
HTML
.FrozenCell
{
   position: relative;
}


Aspx page :
ASP.NET
<asp:TemplateField HeaderText=Name; SortExpression=Name; HeaderStyle-CssClass=FrozenCell; ItemStyle-CssClass=FrozenCell/>
Posted
Updated 29-Aug-14 22:15pm
v3

1 solution

Please use CSS Styles attributes Mask or use below

Datagridview1.Columns("Name").Frozen=True

or

SQL
o freeze a column programmatically

Set the DataGridViewColumn.Frozen property to true:

Me.dataGridView1.Columns("AddToCartButton").Frozen = True
 
Share this answer
 
Comments
kirubakaran3@yahoo.co.in 1-Sep-14 17:08pm    
Hi Jitendra, amn't getting an option for using gridview.columns["Col name"].frozen in c# asp.net. I can see gridviw.column(index) only. Where Exactly i need to place the mentioned line. i tried in row_created event also. but no luck.

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