Hi,
I have two problems with my WebHierarchicalDataGrid :
I could find some topic about these problems, but no solution.
First :
I have a 7 level WebHierarchicalDataGrid (It is therefore extremely slow to load all items simultaneously).
I thus chose to load manually each level on demand. The first and second level loading works fine, but from the third an exception is raised : Async Request Failed NullReferenceException, before the RowIslandsPopulating event is raised.
Second :
I expand (successfully) one of the first level's row, then I cannot expand any other row of the same level. The RowIslandsPopulating event is not raised anymore and nothing happen.
here's a piece of code (for the 3 firsts levels):
Protected Sub Grid_RowIslandsPopulating(sender As Object, e As Infragistics.Web.UI.GridControls.ContainerRowCancelEventArgs)
e.Cancel = True
If e.Row.Expanded Then
Exit Sub
End If
Select Case e.Row.Level
Case 0
Me.LoadSecondLevel(e.Row)
Case 1
Me.LoadThirdLevel(e.Row)
End Select
End Sub
Protected Sub Grid_InitializeRow(sender As Object, e As RowEventArgs)
Try
Dim row As ContainerGridRecord = CType(e.Row, ContainerGridRecord)
If row IsNot Nothing AndAlso row.Level < 7 Then
row.IsEmptyParent = True
Catch ex As Exception
End Try
Private Sub LoadSecondLevel(pParentRow As ContainerGridRecord)
'--- Clear RowIsland from previous bindings
pParentRow.RowIslands.Clear()
'--- Crate new child grid
Dim childGrid As ContainerGrid = New ContainerGrid()
'--- Add the new grid to parent as a row island
pParentRow.RowIslands.Add(childGrid)
childGrid.AutoGenerateColumns = False
childGrid.Columns.Clear()
'--- Create columns for the child grid
Me.CreateSecondLevelColumns(childGrid)
'--- Get the selected software
Dim softwareId = CInt(pParentRow.Items.FindItemByKey("SoftwareId").Value)
Dim sofware = Softwares.FirstOrDefault(Function(p_Ele) p_Ele.ID = softwareId)
'--- bind the new grid to the software patches
If sofware IsNot Nothing Then
childGrid.DataKeyFields = "ID"
childGrid.Level = 1
childGrid.DataSource = sofware.Patchs
childGrid.DataBind()
Private Sub LoadThirdLevel(p_ParRow As ContainerGridRecord)
'--- Load patch versions
LoadThirdLevelFirst(p_ParRow)
'--- Load patch customers
LoadThirdLevelSecond(p_ParRow)
ShowError(ex.Message)
DspErr(ex, "Outils_Patch", "LoadVersionsRowIsland")
Private Sub LoadThirdLevelFirst(pParentRow As ContainerGridRecord)
Me.CreateThirdLevelFirstColumns(childGrid)
Dim patchId = CInt(pParentRow.Items.FindItemByKey("PatchId").Value)
Dim patch = Patchs.FirstOrDefault(Function(p_Ele) p_Ele.ID = patchId)
If patch IsNot Nothing Then
childGrid.Level = 2
childGrid.DataSource = patch.Versions
Private Sub LoadThirdLevelSecond(pParentRow As ContainerGridRecord)
Me.CreateThirdLevelSecondColumns(childGrid)
childGrid.ClearDataSource()
childGrid.DataSource = patch.Organisations
Private Sub CreateSecondLevelColumns(p_Gri As ContainerGrid)
'--- Create the 'ID' column
Dim idField = New Infragistics.Web.UI.GridControls.BoundDataField()
With idField
.Header.Text = "Identity"
.Key = "PatchId"
.DataFieldName = "ID"
.Hidden = True
End With
p_Gri.Columns.Add(idField)
'--- Create a checkbox column
Dim checkboxField = New Infragistics.Web.UI.GridControls.UnboundCheckBoxField()
With checkboxField
.Key = "DeletePatch"
.Width = New WebControls.Unit(35, UnitType.Pixel)
p_Gri.Columns.Add(checkboxField)
'--- Create a 'Version' column
Dim versionField = New Infragistics.Web.UI.GridControls.BoundDataField()
With versionField
.Header.Text = "Patches"
.Key = "Version"
.DataFieldName = "TargetVersion"
.Hidden = False
p_Gri.Columns.Add(versionField)
'--- Create a 'description' column
Dim descriptionField = New Infragistics.Web.UI.GridControls.BoundDataField()
With descriptionField
.Header.Text = "Description"
.Key = "Description"
.DataFieldName = "Description"
.Width = New WebControls.Unit(80, UnitType.Percentage)
p_Gri.Columns.Add(descriptionField)
Private Sub CreateThirdLevelFirstColumns(p_Gri As ContainerGrid)
.Key = "VersionId"
'--- Create a 'Versions' column
Dim versionsField = New Infragistics.Web.UI.GridControls.BoundDataField()
With versionsField
.Header.Text = "Concerned Versions"
.Key = "Versions"
.DataFieldName = "ConcernedVersions"
p_Gri.Columns.Add(versionsField)
Private Sub CreateThirdLevelSecondColumns(p_Gri As ContainerGrid)
.Key = "CustomerId"
GridName_RowIslandsPopulating is not fired when the first(main) grid is loaded.
Using Hierachical grid.
Added the event to html markup. also tried registering the event on Initialize method, still no success. There is no error on the page.
Hello,
Let me know if I may be of further assistance.
Thank you for contacting us.
I have reviewed the provided code snippet and I didn't notice something strange. In order to investigate this further for you I will need a small working sample that is reproducing the issue.
It is important to have DataKeyFields, DataMember and Key specified.
For manual load on demand, RowIslandsPopulating event is raised every time a row is expanded. You will need to cancel the default automatic load on demand operation, and after that to create a ContainerGrid with some DataSource and add it to Row.RowIslands collection.
My suggestion is also to have a look at our online sample regarding manual load on demand, I hope you can benefit from it (http://es.infragistics.com/samples/aspnet/hierarchical-data-grid/manual-load-on-demand).
Helpful reference:
http://help.infragistics.com/Help/Doc/ASPNET/2014.2/CLR4.0/html/WebHierarchicalDataGrid_Load_On_Demand.html
Looking forward to hearing from you.