Hi,
I am doing rebind Grid Grouping Control(v2.0.50727) with data set that has GrandChild Relations. When I am chaging the Grid view from dataset that has Nested Relations to another view I am getting the following error.
Please help me with this issue.
Exception:
Source Assembly: Syncfusion.Grouping.Base
Error Message: Object reference not set to an instance of an object.
Target Site:
Void .ctor(Syncfusion.Grouping.Element)
Stack Trace:
at Syncfusion.Grouping.Internals.ElementTreeTable..ctor(Element owner)
at Syncfusion.Grouping.Internals.SectionsTreeTable..ctor(Group owner)
at Syncfusion.Grouping.Group..ctor(Element parent)
at Syncfusion.Grouping.ChildTable..ctor(Element parent)
at Syncfusion.Windows.Forms.Grid.Grouping.GridChildTable..ctor(Element parent)
at Syncfusion.Windows.Forms.Grid.Grouping.GridEngine.CreateChildTable(Element parent)
at Syncfusion.Grouping.TableDescriptor.CreateChildTable(Element parent, Boolean hasRecords, Table table, SortColumnDescriptorCollection fields)
at Syncfusion.Grouping.Table.InitTopLevelGroup()
at Syncfusion.Grouping.Table.CategorizeElements()
at Syncfusion.Grouping.Table.OnEnsureInitialized(Object sender)
at Syncfusion.Grouping.Element.EnsureInitialized(Object sender, Boolean notifyParent)
at Syncfusion.Grouping.Table.EnsureInitialized(Object sender, Boolean notifyParent)
at Syncfusion.Grouping.Element.EnsureInitialized(Object sender)
at Syncfusion.Grouping.Table.get_TopLevelGroup()
at Syncfusion.Grouping.Table.get_FilteredChildTableOrTopLevelGroup()
at Syncfusion.Windows.Forms.Grid.Grouping.GridNestedTableControl.get_CurrentCell()
at Syncfusion.Windows.Forms.Grid.Grouping.GridTableControl.DeactivateCurrentCell(Boolean allowCancel)
at Syncfusion.Windows.Forms.Grid.Grouping.GridTableControl.Table_DisplayElementChanging(Object sender, DisplayElementChangingEventArgs e)
at Syncfusion.Windows.Forms.Grid.Grouping.GridTableModel.OnDisplayElementChanging(DisplayElementChangingEventArgs e)
at Syncfusion.Windows.Forms.Grid.Grouping.GridTableModel.Syncfusion.Grouping.ITableEventsTarget.OnDisplayElementChanging(DisplayElementChangingEventArgs e)
at Syncfusion.Grouping.TableDescriptor.Syncfusion.Grouping.ITableEventsTarget.OnDisplayElementChanging(DisplayElementChangingEventArgs e)
at Syncfusion.Grouping.Table.OnDisplayElementChanging(DisplayElementChangingEventArgs e)
at Syncfusion.Grouping.Table.RaiseDisplayElementChanging(Element element, Int32 oldCount, Int32 newCount, Boolean repaintElement, Boolean syncCurrentRecordPos, Boolean leaveCurrentRecord, Boolean scroll)
at Syncfusion.Grouping.Table.Engine_PropertyChanging(Object sender, DescriptorPropertyChangedEventArgs e)
at Syncfusion.Windows.Forms.Grid.Grouping.GridTable.Engine_PropertyChanging(Object sender, DescriptorPropertyChangedEventArgs e)
at Syncfusion.Grouping.DescriptorPropertyChangedEventHandler.Invoke(Object sender, DescriptorPropertyChangedEventArgs e)
at Syncfusion.Grouping.Engine.OnPropertyChanging(DescriptorPropertyChangedEventArgs e)
at Syncfusion.Windows.Forms.Grid.Grouping.GridEngine.TableDescriptor_PropertyChanging(Object sender, DescriptorPropertyChangedEventArgs e)
at Syncfusion.Grouping.DescriptorPropertyChangedEventHandler.Invoke(Object sender, DescriptorPropertyChangedEventArgs e)
at Syncfusion.Grouping.TableDescriptor.OnPropertyChanging(DescriptorPropertyChangedEventArgs e)
at Syncfusion.Windows.Forms.Grid.Grouping.GridTableDescriptor.ResetTableDescriptor()
at Syncfusion.Windows.Forms.Grid.Grouping.GridGroupingControl.ResetTableDescriptor()
at FORECAST_MGR.ComponentForms.ForecastExceptions.BindData(ForecastExceptionsDataSet ds, VIEWEXCPS excpView)
UD
Uma Datla
May 2, 2007 04:04 PM UTC
Hi Haneef,
I have followed the Example GridGroupingRebind. In my Grid I have 3 views. Each view has a different datasource. One of the Grid view has Parent to Child and Child to Grand Child Relation dataset. When I switch the Grid from this view to another I am getting the above exception. The Exception is coming from GridGroupingControl.ResetTableDescriptor().
Please see below for my GridRebind() code.
private void BindData(ForecastExceptionsDataSet ds, VIEWEXCPS excpView)
{
try
{
//ggFcstExcps is the GridGrouping Control
this.ggFcstExcps.DataBindings.Clear();
switch (excpView)
{
case VIEWEXCPS.EXCP_TYPE:
this.ggFcstExcps.DataSource = ds.BUYER_EXCPS_COUNT_BY_EXCPTYPE;
break;
case VIEWEXCPS.VENDOR:
//change this later to Vendor Table
this.ggFcstExcps.DataSource = ds.BUYER_ROG_LIST;
break;
case VIEWEXCPS.WAREHOUSE:
this.ggFcstExcps.DataSource = ds.WH_EXCEPTIONS;
break;
default:
this.ggFcstExcps.DataSource = ds.BUYER_EXCPS_BY_EXCPTYPE;
break;
}
if (this.ggFcstExcps.TableDescriptor != null)
{
this.ggFcstExcps.ResetTableDescriptor();
this.ggFcstExcps.TableDescriptor.Relations.Reset();
}
// Show group area
this.ggFcstExcps.ShowGroupDropArea = false;
// Additionial table descriptors currently habe to be added manually.
AddGroupDropAreas(this.ggFcstExcps.Table);
// Make changes to schema. See above notes how to reset changes.
SetReadOnly(this.ggFcstExcps.Table);
}
catch (Exception ex)
{
ErrorHandler.HandleError(new ErrorDetails(Error.C17201, ex));
}
}
Please help me with this issue.
Thanks
Uma
UD
Uma Datla
May 4, 2007 05:11 PM UTC
I have solved this issue by calling this line of code before setting the data source to the Grid.
this.gridGroupingControl1.Tabledescriptor.Relations.clear();