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

TableDescriptor.Columns.Count raise exception

Exception happen in following call gridGroupingControl.TableDescriptor.Columns.Count;

for(int index = 0; index < gridGroupingControl.TableDescriptor.Columns.Count; index++)
{
...
}

Exception content:

"Object reference not set to an instance of an object."

"Syncfusion.Grid.Grouping.Windows"

at Syncfusion.Windows.Forms.Grid.Grouping.GridGroupingControl.engine_SourceListChanged(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at Syncfusion.Grouping.Engine.OnSourceListChanged(EventArgs e)
at Syncfusion.Windows.Forms.Grid.Grouping.GridEngineBase.OnSourceListChanged(EventArgs e)
at Syncfusion.Grouping.Engine.SetSourceList(IEnumerable value)
at Syncfusion.Windows.Forms.Grid.Grouping.GridEngineBase.SetCurrencyManager(CurrencyManager value)
at Syncfusion.Windows.Forms.Grid.Grouping.GridEngineBase.get_CurrencyManager()
at Syncfusion.Windows.Forms.Grid.Grouping.GridEngineBase.GetSourceListBase()
at Syncfusion.Grouping.Engine.GetSourceList()
at Syncfusion.Grouping.FieldDescriptorCollection.EnsureInitialized(Boolean populate)
at Syncfusion.Grouping.FieldDescriptorCollection.get_Count()
at Syncfusion.Windows.Forms.Grid.Grouping.GridColumnDescriptorCollection.EnsureInitialized(Boolean populate)
at Syncfusion.Windows.Forms.Grid.Grouping.GridColumnDescriptorCollection.get_Count()
at OpsCenter.UI.Editor.Grid.AsbtractGridController`1.Render(Object dataSource, ICollection`1 dataProperties) in C:\Projects\Petris\Chinook\OpsCenter\v5\Trunk\OpsCenter.UI\Editor\Grid\AsbtractGridController.cs:line 714



Untitled_17f9d887.png

3 Replies

LS Lingaraj S Syncfusion Team June 23, 2009 04:58 PM UTC

Hi Sergey,

Thank you for your interest in Syncfusion product.

The issue might have occurred due to the improper binding of data source in GridGroupingControl. So please try using following step to bind the data source in GridGroupingControl

Refer the code below:

this.gridGroupingControl1.BeginUpdate();
this.gridGroupingControl1.TableDescriptor.Reset();
this.gridGroupingControl1.DataSource = null;
this.gridGroupingControl1.DataMember = null;
this.gridGroupingControl1.DataSource = array;
this.gridGroupingControl1.EndUpdate(true);
this.gridGroupingControl1.Refresh();


Please let me know if you have any queries.

Regards,
Lingaraj S.


SM Sergey Merkuriev June 26, 2009 09:05 PM UTC

This way I have null reference exception when all BeginUpdate.

All that happen if I try display DataTable with zero rows and columns.


JJ Jisha Joy Syncfusion Team June 29, 2009 12:46 PM UTC

Hi Sergey,

It is difficult to identify the problem without seeing it in a live application. Could you please provide us a sample that shows issue or reprodcue the issue in any one of our browser sample?. So that we could analyze it further annd provide a better solution.

Thank you for using Syncfusion products.

Regards,
Jisha

Loader.
Live Chat Icon For mobile
Up arrow icon