We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Clearing a DataBoundGrid

Thread ID:

Created:

Updated:

Platform:

Replies:

43700 May 1,2006 09:09 AM May 2,2006 06:44 PM Windows Forms 2
loading
Tags: GridControl
Rasmus Fynbo
Asked On May 1, 2006 09:09 AM

I''m using this code for rebinding datasets to the grid, but whenever the dataset is empty or null the grid doesn''t clear by it self. I would it expect to display nothing instead of the last known dataset. How do I get it to clear the grid when the dataset is empty? private void BindData(Syncfusion.Windows.Forms.Grid.GridDataBoundGrid grid, DataSet ds, bool isEmpty) { grid.BeginInit(); grid.SuspendLayout(); if (isEmpty == true) grid.DataSource = null; else grid.DataSource = ds != null ? ds.Tables[0] : null; grid.ResumeLayout(true); grid.EndInit(); }

Administrator [Syncfusion]
Replied On May 1, 2006 11:57 PM

Hi Rasmus, Please try this code to clear the Internal columns in GridDataBoundGrid .Here is a code snippet. private void BindData(Syncfusion.Windows.Forms.Grid.GridDataBoundGrid grid, DataSet ds, bool isEmpty) { grid.BeginInit(); grid.SuspendLayout(); gridDataBoundGrid1.Binder.InternalColumns.Clear(); //For clear the column in a grid if (isEmpty == true) grid.DataSource = null; else grid.DataSource = ds != null ? ds.Tables[0] : null; grid.ResumeLayout(true); grid.EndInit(); } Please let me know if this helps. Regards, Haneef

Rasmus Fynbo
Replied On May 2, 2006 06:44 PM

Ah, we figured out that the problem occured because in our datamodel we made a new dataset instead of filling new data into the same dataset. Changing that made everything else work, but thanks for the solution :)

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;