Link to home
Create AccountLog in
Avatar of VBdotnet2005
VBdotnet2005Flag for United States of America

asked on

Gridview - hide colum ID

I followed this sample on sorting Gridview columns from code behind. Is there a way to hide column "ID"? It is datakeynames
http://www.youtube.com/watch?v=bBXKMencFKA
Avatar of Kiran Sonawane
Kiran Sonawane
Flag of India image

You can do like this

MyGridView.Columns[0].Visible = false;
sonawanekiran is correct.

You can also hide the column from aspx page like below:

<asp:BoundField DataField="ID" Visible="false" />
ASKER CERTIFIED SOLUTION
Avatar of Ramkisan Jagtap
Ramkisan Jagtap
Flag of Finland image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
@ramkisan, when i started to post my answer, i couldnt see ur comment...and hence the same answer repeats
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account