Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to clear gridview

I want to clear my gridview. I have 2 GridViews and Has Select Button On It. on Selecting this button that item goes into the second gridview. now the question is how should i clear the second grid view. I am trying the clear method but clear method is not found in my visual studio..

like image 696
vishal Avatar asked Feb 13 '10 08:02

vishal


2 Answers

dataGridView1.DataSource = null;

or

dataGridView1.Rows.Clear();
like image 118
Patrick Kafka Avatar answered Sep 28 '22 07:09

Patrick Kafka


gridview.DataSource = null;
//rebind to gridview
gridview.DataBind();
like image 29
nebula Avatar answered Sep 28 '22 08:09

nebula