NA
Nisha Arockiya A
Syncfusion Team
March 19, 2009 12:31 PM UTC
Hi Stephane,
Thanks for your interest in Syncfusion Products.
Please refer this forum thread:
GridTableModelLet me know if this helps.
Best Regards,
Nisha.
S_
Stephane _
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.
S_
Stephane _
March 25, 2009 05:16 PM UTC
In your sample, if I call CreateData() twice. The second time model will be null.
LS
Lingaraj S
Syncfusion Team
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
S_
Stephane _
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?
S_
Stephane _
March 30, 2009 02:01 PM UTC
Typo: Does it work on your side?
S_
Stephane _
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()
LS
Lingaraj S
Syncfusion Team
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
S_
Stephane _
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.
LS
Lingaraj S
Syncfusion Team
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.zipPlease let me know if you have any questions.
Regards,
Lingaraj S
S_
Stephane _
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>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
LS
Lingaraj S
Syncfusion Team
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
S_
Stephane _
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'.
LS
Lingaraj S
Syncfusion Team
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].zipRegards,
Lingaraj S.
S_
Stephane _
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!