Click here to Skip to main content
15,922,533 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
am having a datagrid with 3 columns. i want to delete the current structure of the grid(means all the columns) in a single button click.

I tried the below one
C#
dgv_show.Columns.Clear();

it clear all the rows in grid not columns
Any body please help me to solve this
Posted
Updated 9-May-12 9:52am
v2

try this


C#
datatable1.columns.clear
 
Share this answer
 
Comments
kevin_ze 9-May-12 8:05am    
Thanks For ur idea
Try this,

C#
GridViewID.DataSource =null;
 GridViewID.DataBind();
 
Share this answer
 
Comments
kevin_ze 9-May-12 7:33am    
GridViewID.DataBind();
option is not there in C#.net and am doing window form
devbtl 9-May-12 16:18pm    
If you are developing win forms then add the above lines

datagridview1.datasource=null;

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