Click here to Skip to main content
15,919,500 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm not using <columns> in .aspx page. because every time column name could be different there is more than 30 columns in each table/ dataset. value is displaying on gridview. I want to hide some columns by clicking on columns name from gridview. how can i achieve this.

What I have tried:

int indexOfColumn = 1;
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.Cells.Count > indexOfColumn)
{
e.Row.Cells[indexOfColumn].Visible = false;
}
}

But this is not dynamic
Posted

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