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.
Syncfusion Feedback

Model of child table

Thread ID:

Created:

Updated:

Platform:

Replies:

80182 Mar 18,2009 03:16 PM UTC May 5,2009 05:28 PM UTC WinForms 17
loading
Tags: Grouping
Stephane _
Asked On March 18, 2009 03:16 PM UTC

Hi,

How do I get the model of child table?

I'm able to get the descriptor: gridGroupingControl1.GetTableDescriptor("Childs")
But not the model: gridGroupingControl1.GetTableModel("Childs")

It throws a weird NullReferenceException.

I need the model because I want to handle the QueryCoveredRange exception.



GC_GroupHierarchy_2d3b1490.zip

Nisha Arockiya A [Syncfusion]
Replied On March 19, 2009 12:31 PM UTC

Hi Stephane,

Thanks for your interest in Syncfusion Products.

Please refer this forum thread:
GridTableModel

Let me know if this helps.

Best Regards,
Nisha.


Stephane _
Replied On March 19, 2009 01:47 PM UTC

On that thread he is able to get the model. His problem is getting the GroupingControl.

Calling GetTableModel on my grid throws an exception.



Nisha Arockiya A [Syncfusion]
Replied On March 20, 2009 12:08 PM UTC


Hi Stephane,

Thanks for the update.

Here is your modified sample.
http://files.syncfusion.com/samples/Grid.Windows/GC_GroupHierarchy_VB.zip

Let me know if this helps.

Best Regards,
Nisha.



Stephane _
Replied On March 25, 2009 05:16 PM UTC

In your sample, if I call CreateData() twice. The second time model will be null.


Lingaraj S [Syncfusion]
Replied On March 28, 2009 10:25 AM UTC

Hi Stephane,

Thank you for the update.

Before rebinding the datasource in GridGroupingControl, please try to set the datasource property to Nothing.

Please refer the code below:

gridGroupingControl1.DataSource = Nothing
gridGroupingControl1.DataSource = bindingList


Let me know if you have any queries.

Regards,
Lingaraj S


Stephane _
Replied On March 30, 2009 01:59 PM UTC

Even if I set the datasource to nothing before rebinding it, model is still null.

Does it work on your site?


Stephane _
Replied On March 30, 2009 02:01 PM UTC

Typo: Does it work on your side?


Lingaraj S [Syncfusion]
Replied On March 31, 2009 04:17 PM UTC

Hi Stephene,

Thanks for your update.

Please refer the modified sample, where I am unable to see any issue on tablemodel when I rebind the GridGroupingControl:
http://files.syncfusion.com/samples/Grid.Windows/GC_GroupHierarchy_VB[1].zip

Please let me know if you have any queries.

Regards,
Lingaraj S



Stephane _
Replied On March 31, 2009 04:56 PM UTC

The button does not work, it gives a "Object reference not set to an instance of an object." exception.

I'm using version 5.202.0.25

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

at Syncfusion.Grouping.Internals.ElementTreeTable..ctor(Element owner)
at Syncfusion.Grouping.Group..ctor(Element parent)
at Syncfusion.Grouping.ChildTable..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.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.GridEngineBase.set_DataSource(Object value)
at Syncfusion.Windows.Forms.Grid.Grouping.GridGroupingControl.set_DataSource(Object value)
at testGrid.Form1.CreateData() in C:\Documents and Settings\[username]\Desktop\GC_GroupHierarchy_VB[1]\Form1.vb:line 50
at testGrid.Form1.Button1_Click(Object sender, EventArgs e) in C:\Documents and Settings\[username]\Desktop\GC_GroupHierarchy_VB[1]\Form1.vb:line 82
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at testGrid.Form1.Main() in C:\Documents and Settings\[username]\Desktop\GC_GroupHierarchy_VB[1]\Form1.vb:line 75
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()


Lingaraj S [Syncfusion]
Replied On April 2, 2009 05:46 PM UTC

Hi Stephane,

Thank you for the update.

Please try to use the ResetTableDescriptor() method to avoid this issue.

Please refer the code below:

Me.gridGroupingControl1.ResetTableDescriptor()
gridGroupingControl1.DataSource = Nothing
gridGroupingControl1.DataSource = bindingList

Let me know if you have any queries.

Regards,
Lingaraj S


Stephane _
Replied On April 2, 2009 06:56 PM UTC

Now it does not crash but model is still null when I press the button.

When the form loads it's ok.


Lingaraj S [Syncfusion]
Replied On April 3, 2009 02:48 PM UTC

Hi Stephane,

Thank you for your update.

I am afraid that I was not able to reproduce the issue that you have mentioned here with the provided version.
Also I have attached the video file in below link which I tried in the sample.

http://files.syncfusion.com/samples/Grid.Windows/5.2.0.25/CreateModel.zip

Please let me know if you have any questions.

Regards,
Lingaraj S



Stephane _
Replied On April 3, 2009 06:51 PM UTC

It works just like the video. What I mean is add the code below. When the application opens you will see the message box "Something", when you press the button you will see "Nothing". This is the problem that I have, I need the have the model even on the second time.



'>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>New Code>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Dim gt As GridTable = gridGroupingControl1.GetTable("RelatedChilds")
Dim model As GridTableModel = gt.TableModel

If model Is Nothing Then
MessageBox.Show("Nothing")
Else
MessageBox.Show("Something")
End If
'>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>New Code>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


Lingaraj S [Syncfusion]
Replied On April 7, 2009 06:29 PM UTC

Hi Stephen,

Thank you for your update.

Please try using the ResetRelations() method to avoid this issue.


me.gridGroupingControl1.TableDescriptor.ResetRelations()
Dim gt As GridTable = gridGroupingControl1.GetTable("RelatedChilds")
Dim model As GridTableModel = gt.TableModel

If model Is Nothing Then
MessageBox.Show("Nothing")
Else
MessageBox.Show("Something")
End If


Let me know if you have any queries.

Regards,
Lingaraj S


Stephane _
Replied On April 7, 2009 07:55 PM UTC

Is there an other option?

I tried ResetRelations in the past. I have custom columns that derive from ColumnDescriptor.
When I do a ResetRelations, it looks like all the columns are recreated as ColumnDescriptor instead of the one I created.

I get:

Unable to cast object of type 'Syncfusion.Windows.Forms.Grid.Grouping.GridColumnDescriptor' to type 'CustomColumnDescriptor'.



Lingaraj S [Syncfusion]
Replied On April 10, 2009 10:39 AM UTC

Hi Stephen,

Thank you for your update.

I am unable to reproduce this issue as mentioned in previous update. I have tried with GridColumn descriptor in the CreateData() method, I got the GridModel and the columns correctly added in the GridGroupingControl.

Please refer the sample below and if you have still face this issue try to reproduce in this sample:
http://files.syncfusion.com/samples/Grid.Windows/5.2.0.25/GC_GroupHierarchy_VB[2].zip

Regards,
Lingaraj S.



Stephane _
Replied On May 5, 2009 05:28 PM UTC

It's been a while but I wanted to say that I had it fix with your help.

Thanks!



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.

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

;