While I develop application using ASP.Net with C#, I want to share small knowledge to visible unnecessary fields in GridView. Sometime you don't want to show some data in interface, but you still can use theirs values. It just high on the form. Please see code below to visible field in gridview:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
e.Row.Cells[1].Visible = false;
}
- e.Row.Cells[1].Visible is the field index that you want to visible.
In page design of GridView:
OnRowDataBound="GridView1_RowDataBound"
When you run code, it will not see field index No1. and you can also add other field in gridview.
No comments:
Post a Comment