Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
245
Manual Load On Demand + Error on expanding Third Level Items
posted

Hello community!

I'm working with the WebDataTree and I have a problem when I try to expand the Third Level Items.

First level gets loaded fine. Also the second level.

When I try to expand to the next level, an error occurs "Async request failed".

This reminds me of an error of the WebHierarchicalDataGrid.

Here is my code. And I also attached a working sample :)

Please kindly help me. I would appreciate it so much!

Sincerely,

George K.

Source code:

Default.aspx

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="WebDataTree._Default" %>
<%@ Register Assembly="Infragistics35.Web.v11.1, Version=11.1.20111.1006, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" Namespace="Infragistics.Web.UI.NavigationControls" TagPrefix="ig" %>
<!DOCTYPE html>
<html>
    <head>
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
            <asp:ScriptManager ID="scm" runat="server"></asp:ScriptManager>
            <asp:Button ID="btnLoad" runat="server" Text="Load Data" />
            <ig:WebDataTree ID="wdtTestsGroups" runat="server"
                StyleSetName="Default" SelectionType="Single"
                BorderStyle="None" BorderWidth="0px"
                NodeIndent="26" EnableConnectorLines="True"
                Width="100%" Height="100%" CheckBoxMode="BiState"
                EnableAjaxViewState="False"
                OnNodePopulate="wdtTestsGroups_NodePopulate">
            </ig:WebDataTree>
        </form>
    </body>
</html>

Default.aspx.vb

    Protected Sub btnLoad_Click(sender As Object, e As EventArgs) Handles btnLoad.Click
        Dim dt As DataTable = GetTestGroups()
        wdtTestsGroups.Nodes.Clear()

        For Each row As DataRow In dt.Rows()
            If row("PARENTTESTGROUP_ID") Is DBNull.Value Then
                Dim dtn As New DataTreeNode()
                dtn.Key = row("TESTGROUP_ID")
                dtn.Text = row("DESCRIPTION")
                dtn.IsEmptyParent = True

                If Not row("DISABLESELECTION") Is DBNull.Value Then
                    If Val(row("DISABLESELECTION")) = 1 Then
                        dtn.Enabled = False
                        dtn.IsEmptyParent = False
                    End If
                End If

                wdtTestsGroups.Nodes.Add(dtn)
            End If
        Next
    End Sub

    Protected Sub wdtTestsGroups_NodePopulate(sender As Object, e As Infragistics.Web.UI.NavigationControls.DataTreeNodeEventArgs)
        If e.Node.HasChildren Then Exit Sub

        Dim dtParents As DataTable = GetTestGroupsInTestGroups(e.Node.Key)
        Dim dtTests As DataTable = GetTestsInTestGroups(e.Node.Key)

        For Each row1 As DataRow In dtParents.Rows
            Dim dtn As New DataTreeNode()
            dtn.Key = row1("TESTGROUP_ID")
            dtn.Text = row1("DESCRIPTION")
            dtn.Populated = False
            dtn.IsEmptyParent = True

            If Not row1("DISABLESELECTION") Is DBNull.Value Then
                If Val(row1("DISABLESELECTION")) = 1 Then
                    dtn.Enabled = False
                    dtn.IsEmptyParent = False
                End If
            End If

            e.Node.Nodes.Add(dtn)
        Next

        For Each row2 As DataRow In dtTests.Rows
            Dim dtn As New DataTreeNode()
            dtn.Key = row2("TEST_ID")
            dtn.Text = row2("TESTNAME")
            e.Node.Nodes.Add(dtn)
        Next

        dtParents.Dispose()
        dtTests.Dispose()
    End Sub

    Protected Function GetTestGroups() As DataTable
        Dim dt As New DataTable
        Dim query As String = "SELECT TESTGROUP_ID,DESCRIPTION,PARENTTESTGROUP_ID,DISABLESELECTION FROM TESTGROUPS WHERE PARENTTESTGROUP_ID IS NULL ORDER BY DESCRIPTION"

        Using cs As New OleDbConnection(System.Configuration.ConfigurationManager.ConnectionStrings("CS").ConnectionString)
            cs.Open()
            Using cmd As New OleDbCommand(query, cs)
                Using da As New OleDbDataAdapter(cmd)
                    da.Fill(dt)
                    da.Dispose()
                End Using
            End Using
            cs.Close()
        End Using

        Return dt
    End Function

    Protected Function GetTestGroupsInTestGroups(ByVal id As Integer) As DataTable
        Dim dt As New DataTable
        Dim query As String = "SELECT TESTGROUP_ID,DESCRIPTION,PARENTTESTGROUP_ID,DISABLESELECTION FROM TESTGROUPS WHERE PARENTTESTGROUP_ID=" & id & " ORDER BY DESCRIPTION"

        Using cs As New OleDbConnection(System.Configuration.ConfigurationManager.ConnectionStrings("CS").ConnectionString)
            cs.Open()
            Using cmd As New OleDbCommand(query, cs)
                Using da As New OleDbDataAdapter(cmd)
                    da.Fill(dt)
                    da.Dispose()
                End Using
            End Using
            cs.Close()
        End Using

        Return dt
    End Function

    Protected Function GetTestsInTestGroups(ByVal id As Integer) As DataTable
        Dim dt As New DataTable
        Dim query As String = "SELECT TESTS.TEST_ID,TESTNAME FROM TESTS INNER JOIN TESTGROUPS_TESTS ON TESTS.TEST_ID=TESTGROUPS_TESTS.TEST_ID WHERE TESTGROUP_ID=" & id & " ORDER BY TESTNAME"

        Using cs As New OleDbConnection(System.Configuration.ConfigurationManager.ConnectionStrings("CS").ConnectionString)
            cs.Open()
            Using cmd As New OleDbCommand(query, cs)
                Using da As New OleDbDataAdapter(cmd)
                    da.Fill(dt)
                    da.Dispose()
                End Using
            End Using
            cs.Close()
        End Using

        Return dt
    End Function

Parents Reply Children
No Data