This is a migrated thread and some comments may be shown as answers.

How to clear Grid rows

7 Answers 150 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Veshala
Top achievements
Rank 1
Veshala asked on 26 Oct 2009, 04:08 PM
Hi,

I have a Radgrid, which populates with search criteria result set. My requirement is to clear the grid rows when user click on 'Clear criteria' button. I just want to clear the rows and keep the column names as it is.

Thanks

7 Answers, 1 is accepted

Sort by
0
Schlurk
Top achievements
Rank 2
answered on 26 Oct 2009, 08:17 PM
Are you looking to delete or just clear the selection? I'm not sure how you do your search criteria but if you just do a search for, lets say " " or a character you know does not exist in your grid it should return a blank grid with all the columns intact.
0
Veshala
Top achievements
Rank 1
answered on 26 Oct 2009, 08:29 PM
Thanks for the reply.
I am hitting the webservice to get the result set.  To just clear the grid rows, i don't want to hit the webservice again with empty parameter values. Is there any other solution to clear the rows.

Thanks



0
Sunny
Top achievements
Rank 1
answered on 27 Oct 2009, 02:02 PM
0
Veshala
Top achievements
Rank 1
answered on 27 Oct 2009, 02:23 PM
It doesn't work to me.

I want to clear the grid on click of 'Clear button' not on Page_load event.
 protected void btnClearCriteria_Click(object sender, EventArgs e)
  {         
RadGrid1.DataSource = new int[] { }; 
 }
 
I tried this also :
RadGrid1.DataSource = new object[0];

Is there any other solution for this problem.

Thanks

0
Sunny
Top achievements
Rank 1
answered on 27 Oct 2009, 02:51 PM
Try to Rebind()

RadGrid1.DataSource = new int[] { }; 
RadGrid1.Rebind();

0
Veshala
Top achievements
Rank 1
answered on 27 Oct 2009, 02:59 PM
It is working now.

Thank you very much.
0
Evan
Telerik team
answered on 27 Oct 2009, 08:28 PM
Hi Veshala,

It is good to hear everything is working for you know. 

Let us know if you need any help in the future, we (and the community, as you can see) are more than happy to help.

Greetings,
Evan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Veshala
Top achievements
Rank 1
Answers by
Schlurk
Top achievements
Rank 2
Veshala
Top achievements
Rank 1
Sunny
Top achievements
Rank 1
Evan
Telerik team
Share this question
or