Hi!
I''m using an hierarchy GDBG and I would like the first node to be expanded by default.
When I try to call the ExpandAtRowIndex() with the correct rowindex I get an exception thrown from the grid saying:
"Object reference not set to an instance of an object."
Stacktrace:
at Syncfusion.Windows.Forms.Grid.GridDataBoundGrid.ExpandAtRowIndex(Int32 rowIndex)
at Presentation.Forms.PrognosisOrganizationTree.PrognosisOrganizationTree_Load(Object sender, EventArgs e) in c:\\forms.presentation\\forms\\prognosisorganizationtree.cs:line 372
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
The code is placed in the Form_Load event, could that be to early for the grid to expand the node? I have tried to call ExpandAll() instead at the same place which works just fine.
Any ideas?
AD
Administrator
Syncfusion Team
November 23, 2005 12:37 PM UTC
At the bottom of form.Load are you using code like this?
this.gridDataBoundGrid1.ExpandAtRowIndex(this.gridDataBoundGrid1.Model.Rows.HeaderCount + 1);
You have to make sure you pass in the right rowindex as each hierarchylevel has its own column header row. The above code worked for me using version 3.3.
TO
Tomas
November 24, 2005 07:28 AM UTC
Ahh that made it work! Thanks Clay!