The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
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?
ADAdministrator 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.