meghna
meghna

Reputation: 9

clear gridview in vb.net

i am trying to clear the grid view using the following code but it is not working:

da.Fill(dt);

 GridView1.DataSource = dt;

 GridView1.DataBind();

 DataSourceOperation.Delete=GridView1;

 connection.Close();`

please tell me what is wrong in this statement.

Upvotes: 0

Views: 473

Answers (2)

Steve
Steve

Reputation: 549

How about trying this:

dt.Rows.Clear();
GridView1.DataBind();

Upvotes: 0

Matt Wilko
Matt Wilko

Reputation: 27322

Try:

GridView1.DataSource = null;

DataSourceOperation is an enumeration so you can't set an Enumeration to be a GridView. How does this even compile?

Upvotes: 1

Related Questions