Click here to Skip to main content
16,004,564 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
HI Guys

Is there a way to clear gridview rows and columns with out removing gridview header?
because following code dont work.

C#
grvTravelClaims.DataSource = null;
grvTravelClaims.DataBind();

grvTravelClaims.Columns.Clear();
Posted
Updated 4-Apr-12 20:55pm
v2

1 solution

If you remove the columns, then you remove the headers - the headers are the labels for the columns.
Instead, try clearing the rows:
C#
grvTravelClaims.Rows.Clear();
 
Share this answer
 
Comments
Anele Ngqandu 5-Apr-12 3:11am    
The clear method is not available for Rows sir

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