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.

Removing grid from parent control

Thread ID:

Created:

Updated:

Platform:

Replies:

30916 Jun 27,2005 11:55 AM Jun 27,2005 04:29 PM Windows Forms 2
loading
Tags: GridControl
Virgil
Asked On June 27, 2005 11:55 AM

I am receiving a wierd error when removing a GDBG from a parent control (panel). The binding context is changing and throwing an error. Why would the binding contaxt be changing???? To make matters worse, the error is only being thrown on some machines. Below is a stack track and the error received. Thanks in advance for any help. Virgil Line throwing the error: Me.pnlGrid.Controls.Remove(_Grid) Error information: EndItem ID: 20787 EndItem #: qpart1139 EndItem Desc.: Muggles Error: There is no row at position 0. Stack Trace 6/27/2005 11:52:18 AM at System.Data.DataView.GetRecord(Int32 recordIndex) at System.Data.DataView.IsOriginalVersion(Int32 index) at System.Data.DataRowView.SetColumnValue(DataColumn column, Object value) at System.Data.DataColumnPropertyDescriptor.SetValue(Object component, Object value) at Syncfusion.Windows.Forms.Grid.GridModelDataBinder.CancelEdit() at Syncfusion.Windows.Forms.Grid.GridModelDataBinder.RefreshRows(CurrencyManager bmb) at Syncfusion.Windows.Forms.Grid.GridModelDataBinder.Set_ListManager(Object newDataSource, String newDataMember, Boolean force, Boolean forceColumnCreation) at Syncfusion.Windows.Forms.Grid.GridModelDataBinder.OnBindingContextChanged(EventArgs e) at Syncfusion.Windows.Forms.Grid.GridDataBoundGrid.OnBindingContextChanged(EventArgs e) at System.Windows.Forms.Control.AssignParent(Control value) at System.Windows.Forms.ControlCollection.Remove(Control value) at WinCES.EndItemGrid.BindDataGrid(DataSet SourceData, Boolean DisplayAfterBindingIsComplete) in C:\Projects\Lear\WinCES\WinCES\EndItemGrid.vb:line 1385 at WinCES.EndItemGrid.RebuildGrid() in C:\Projects\Lear\WinCES\WinCES\EndItemGrid.vb:line 7673

Administrator [Syncfusion]
Replied On June 27, 2005 02:09 PM

The bindingcontext is normally inherited from the parent when the control is parented. So, the parent can play a role in bindingcontexts. One thing you can try is to set the grid.DataSource = null before you remove it from its parent.COntrols collection to see if this takes care of the problem.

Virgil
Replied On June 27, 2005 04:29 PM

That works. I also had to do the other things normally associated with rebinding the grid to a new datasource (Datamember=null and ResetHierarchyLevels) prior to re-hooking up the datasource.

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.

;