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. Image for the cookie policy date
close icon

How to display empty gridgroupingcontrol

I need to display empty gridgrouping control.

When I assign like below:

this.plangrid.DataSource = string.Empty;

I am getting error message as, "BadDataSourceForComplexBinding".

Please anyone knows, help me ASAP.

Thanks,
Praba


7 Replies

RC Rajadurai C Syncfusion Team March 5, 2009 01:32 PM UTC

Hi Prabakaran,

Thanks for your interest in Syncfusion products.

A gridgroupingcontrol cannot display data without binding it to a datasource. The tabledescriptor must be set with columns and rows. If you would like to display an empty grid, you can bind it to a datasource containing layout for rows and columns(column name) but with no data.

Please let me know if you have any further concerns.

Regards,
Rajadurai



AD Administrator Syncfusion Team March 12, 2009 01:17 PM UTC


Hi,

I am getting the below error, when i ExpandAllRecords in the GCC.

Failed to compare two elements in the array.

Please help me..

Thanks,
Prabha.



RC Rajadurai C Syncfusion Team March 14, 2009 07:48 AM UTC

Hi Praba,

The following code expands all the records without throwing any exception

gridGroupingControl1.Table.ExpandAllRecords();


From your update, it seems that you are handling some condition to expand records. If yes, please provide the code which is throwing exception and the events handled, if any.

Regards,
Rajadurai



AD Administrator Syncfusion Team April 29, 2009 07:09 AM UTC

Hi,

I have condition like:

If(grdgroupcontrol.Table != null)
gridGroupingControl1.Table.ExpandAllRecords();

How do i find how many tables grouped into this groupingcontrol?

Thanks,
Prabha

>Hi Praba,

The following code expands all the records without throwing any exception

gridGroupingControl1.Table.ExpandAllRecords();


From your update, it seems that you are handling some condition to expand records. If yes, please provide the code which is throwing exception and the events handled, if any.

Regards,
Rajadurai





AD Administrator Syncfusion Team April 29, 2009 08:14 AM UTC

Hi,

I am getting the below Exception error.

An exception of type 'System.NullReferenceException' occurred and was caught.

04/29/2009 09:01:13
Type : System.NullReferenceException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Message : Object reference not set to an instance of an object.
Source : Syncfusion.Grouping.Base
Help link :
Data : System.Collections.ListDictionaryInternal
TargetSite :
Stack Trace : at Syncfusion.Grouping.Table.InitUnsortedRecords(Boolean forceParentElement)
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.BaseEnsureInitialized(Object sender, Boolean notifyParent)
at Syncfusion.Grouping.Table.EnsureInitialized(Object sender, Boolean notifyParent)
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.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.Syncfusion.Windows.Forms.Grid.Grouping.IGridTableOptionsSource.RaiseTableOptionsChanging(GridTableOptionsChangedEventArgs e)
at Syncfusion.Windows.Forms.Grid.Grouping.GridTableOptionsStyleInfoIdentity.OnStyleChanging(StyleInfoBase style, StyleInfoProperty sip)
at Syncfusion.Styles.StyleInfoBase.OnStyleChanging(StyleInfoProperty sip)
at Syncfusion.Styles.StyleInfoBase.SetValue(StyleInfoProperty sip, Object value)
at Syncfusion.Windows.Forms.Grid.Grouping.GridTableOptionsStyleInfo.set_AllowSelection(GridSelectionFlags value)
at GM.UI.SmartParts.RangePlan.RangePlanGrid.SetFirstRecordSelected()

Please help me to resolve this.

I trying to setfirstrecord selected after collapse all the records in the grid.

Is it possible?

Thanks,
Prabha



AD Administrator Syncfusion Team April 29, 2009 09:21 AM UTC

Hi,

First time, i have loaded some 50 records and i have done some modifications and saved those records into database.

Then, I am trying load some 150 records, but its loading only 50 records which is filteredrecord count set by previously loaded record count.

How can i clear the filteredrecord count at each time loading data into GCC?

Thanks,
Prabha



LS Lingaraj S Syncfusion Team May 1, 2009 02:19 PM UTC

Hi Prabha,

Thank you for your update.

The GridGroupingControl does not have default property to get the number of related tables. If you want to get the number of tables in GridGroupingControl, please try using RelatedTable property in iterate loop to get the number of tables.
Please refer the code below:

bool flag = true;
int count1=0;
Table tab=this.hierarchyGrid.Table;
while (flag)
{
if (tab != null)
{
count1++;
if (tab.RelatedTables.Count != 0)
tab = tab.RelatedTables[0];
else
flag = false;
}
else
{
flag = false;
}
}
MessageBox.Show(count1.ToString());


If you reload the data in GridGroupingControl, please try to set the DataSource property to null before the rebinding to avoid this issue.
Please refer the rebinding code below:

this.gridGroupingControl1.DataSource = null;
this.gridGroupingControl1.DataMember = null;
this.gridGroupingControl1.ResetTableDescriptor();
this.gridGroupingControl1.TableDescriptor.Relations.Clear();
this.gridGroupingControl1.DataSource = newdatasource;
this.gridGroupingControl1.Refresh();


Let me know if it helps.

Regards,
Lingaraj S.




Loader.
Live Chat Icon For mobile
Up arrow icon