Series: Subject: Topic:
Question: 59 of 169

How to clear a datagrid on a button click?

Asked by: Interview Candidate | Asked on: Dec 6th, 2005
Showing Answers 1 - 3 of 3 Answers

Answered On : Dec 14th, 2005

Hi,You need to Clear the DataSource of the dadaGrid.So try this:dataSet1.Clear();dataGrid1.DataSource = dataSet1.TableNameHere.DefaultView; orC#: dataGrid1.DataSource = null; VB: dataGrid1.DataSource = nothing 

Login to rate this answer.

Answered On : Sep 26th, 2008

View all answers by darkdusky

Easy way to clear a grid without creating new dataset, but this method loses headers also.datagrid1.datasource=""datagrid1.Databind()

Login to rate this answer.

Answered On : Jun 8th, 2009

View all answers by prashant2050

Lets say your grid id is dgCompliance, so to make it empty just write following code in = NothingdgCompliance.DataBind()

Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions



twitter fb Linkedin GPlus RSS


Interview Question

 Ask Interview Question?


Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.