Click here to Skip to main content
15,919,479 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
can i add/remove required columns to gridview at runtime in asp.net using c#
Posted

to add column in gridview:

BoundField bfield = new BoundField();
bfield.HeaderText = "heardename";
bfield.DataField = "column name from db";
GridView1.Columns.Add(bfield);
 
Share this answer
 
yes you can, if you need to remove/hide first column (index 0)
C#
myGridview.Columns[0].Visible = false;
 
Share this answer
 
Comments
Member 10378142 15-May-14 8:24am    
Thanks for your reply..
Actually my requirement is ...
I have already 3 columns in my gridview after running my application can i add another column at run time

Please suggest me
 
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