GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Microsoft  >  DotNet
Go To First  |  Previous Question  |  Next Question 
 DotNet  |  Question 111 of 165    Print  
How to clear a datagrid on a button click?

  
Total Answers and Comments: 3 Last Update: June 08, 2009     Asked by: Ayan Ghosh 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
December 14, 2005 20:08:59   #1  
Alex        

RE: How to clear a datagrid on a button click?

Hi

You need to Clear the DataSource of the dadaGrid.

So try this:

dataSet1.Clear();

dataGrid1.DataSource dataSet1.TableNameHere.DefaultView;

or

C#: dataGrid1.DataSource null;

VB: dataGrid1.DataSource nothing


 
Is this answer useful? Yes | No
September 26, 2008 10:09:57   #2  
darkdusky Member Since: September 2008   Contribution: 1    

RE: How to clear a datagrid on a button click?
Easy way to clear a grid without creating new dataset but this method loses headers also.

datagrid1.datasource
datagrid1.Databind()

 
Is this answer useful? Yes | No
June 08, 2009 05:09:20   #3  
prashant2050 Member Since: June 2009   Contribution: 1    

RE: How to clear a datagrid on a button click?

Lets say your grid id is dgCompliance so to make it empty just write following code in vb.net:

dgCompliance.DataSource Nothing

dgCompliance.DataBind()


 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape