Click here to Skip to main content
15,908,175 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hello to all i am making an asp.net web application..I have a data grid, In that i have 9 columns
in which starting two are fixed and reamining six depends on rights..
In admin section i have mention these seven columns and a check box in front of each column for setting status..now supp. i set status true for 3 columns 'true' and 'false' for four columns and that thing i am saving in database..

now the place where status is 1 i want to show that column and the place where status is 0 i want to hide that column..

how it will be done in datagrid..
thanks in advance
Posted
Comments
Bikash Shrestha From Nepal 15-Nov-10 1:54am    
please Make Yourself Clear

Improvement to sankar answer

// if you want hide/show in page load go for RowDataBound event.
protected void gvTesting_RowDataBound(object sender, GridViewRowEventArgs e)
{
//for column 1
 if(status==1)
  {
     gvTesting.Columns[0].Visible = true;
  }
  else
  {
     gvTesting.Columns[0].Visible = true;
  }

}
 
Share this answer
 
VB
gvTesting.Columns("Name").Visible = true
 
Share this answer
 

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