Click here to Skip to main content
15,905,971 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi guyz,

how can i make a certain column invisbile but still i can access data, the data comes from database and i bind it in gridview dynamically, pls help

thnk in advance
Posted

Here you go

Hide GridView Columns In ASP.NET[^]

Also you try CSS like "style:display:none;" for that particular column(s)
 
Share this answer
 
For this purpose access records from database and bind to gridview as usual. Only set visible property of DataGridViewColumn class as False after binding gridview as below:

DataGridViewColumn column2 = dataGridView1.Columns[1];  // to hide 2nd column 
column2.Visible = false;


Hope this will help you.
 
Share this answer
 
Try
gridview1.Columns[index].Visible = false;
 
Share this answer
 
You can use Bound data field for the gridview and select only those columns which you need to display in the gridview.


I.e set the header text and and the data value field foe each bound field.


The data value field name should be the name of you columns in your DB table to which you are binding the gridview.



I Hope this will help you!!!
 
Share this answer
 
write code for binding gridview provide datasource and databind to it.
then click on intellesence option present on grid control.
click on edit column and add boundField and set datafield to name of field which ur selecting from query
and set headerText property to name u want to display on gridview column
this is what u want..
and it works perfectly...
njoy coding
 
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