Reputation: 690
How to remove one column from a gridview after binding the gridview in the Page_Load event.For example in the below gridview I wish to remove the 'Name' column.
Sno Id Name
1 1002 aaa
2 1004 bbb
Upvotes: 0
Views: 220
Reputation: 11556
Add the below code in RowCreated
event of the GridView
.
Code
e.Row.Cells[2].Visible = false; /*this hides the third column*/
Upvotes: 1
Reputation: 118
In the asp.net grid view you don't have to include the name column from the call. Remove/omit the explicit name column declaration from there. If you can set visible property to no that might help too.
Upvotes: 0