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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Removing grid from parent control

Thread ID:





30916 Jun 27,2005 03:55 PM UTC Jun 27,2005 08:29 PM UTC WinForms 2
Tags: GridControl
Asked On June 27, 2005 03:55 PM UTC

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 06:09 PM UTC

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.

Replied On June 27, 2005 08:29 PM UTC

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.


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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon 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.Close Icon