protected void gvreport_RowCreated(object sender, GridViewRowEventArgs e)
{
if (username=="Admin")// Your Condition for hiding the column
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Cells[4].Visible = false;
}
if (e.Row.RowType == DataControlRowType.Header)
{
e.Row.Cells[4].Visible = false;
}
}
}
Wednesday, November 3, 2010
Hiding datagrid column at runtime in asp.net
Posted by
Vipin
at
11:19 AM
Sometimes you want to hide the column at runtime in datagrid. Below is the code. You can do this on RowCreated event of datagrid.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment