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
1015
Need Help Loading WebDataTree at Runtime
posted

This is used inside an update panel as well.

I cannot use SQL Datasource on asp markup.  All connections are done manually.

My tbl returns data using one table with a recursive relationship on GroupID and UpGroupID for the structure.

 

However no data is showing in the tree?????

 

Thank you in advance.  This is my first post and I have spent half a day trying to get this to work.

 

Page Load Event calls  LoadGRTree()

 

Private Sub LoadGRTree()

        'loads group tree

        Dim objCmd As New SqlCommand

        Dim objDA As New SqlDataAdapter

 

        Dim tbl As New DataTable

        Try

            If objConnP6.State = ConnectionState.Closed Then

                objConnP6.Open()

            End If

            objCmd = New SqlCommand("spGroupsGetAll", objConnP6)

            objCmd.CommandType = CommandType.StoredProcedure

            objCmd.Parameters.Add("@CustID", SqlDbType.Int)

            objCmd.Parameters(0).Direction = ParameterDirection.Input

            objCmd.Parameters(0).Value = CInt(Session("CustID"))

            objDA = New SqlDataAdapter(objCmd)

            tbl.Clear()

            objDA.Fill(tbl)

            If objConnP6.State = ConnectionState.Open Then

                objConnP6.Close()

            End If

            ' Create the view

            Dim view As New Infragistics.Web.UI.DataSourceControls.DataView()

 

            ' Set the required properties

            view.DataSource = tbl

            view.ID = "mainview"

 

            Me.GRWebTreeData.DataViews.Add(view)

 

            Dim dr As New Infragistics.Web.UI.DataSourceControls.DataRelation()

            dr.ParentDataViewID = "mainview"

            dr.ParentColumns = New String() {"GroupID"}

            dr.ChildDataViewID = "mainview"

            dr.ChildColumns = New String() {"UpGroupID"}

            Me.GRWebTreeData.DataRelations.Add(dr)

 

            Me.dtGRGroupsMain.DataSourceID = Me.GRWebTreeData.ID

 

            Dim nodeBinding As New Infragistics.Web.UI.NavigationControls.DataTreeNodeBinding()

            nodeBinding.DataMember = "mainview"

            nodeBinding.TextField = "GroupName"

            nodeBinding.ValueField = "GroupID"

            Me.dtGRGroupsMain.DataBindings.Add(nodeBinding)

 

            Me.dtGRGroupsMain.DataBind()

 

           

 

        Catch ex As Exception

            Throw ex

        Finally

            If Not objDA Is Nothing Then

                objDA.Dispose()

            End If

            If Not objCmd Is Nothing Then

                objCmd.Dispose()

            End If

            If objConnP6.State = ConnectionState.Open Then

                objConnP6.Close()

            End If

        End Try

 

    End Sub

 

 

Asp Markup:

<div id="divGroupsMain" runat="server" style="display:block; margin:0px; border:0px; height:60%;">

                        <asp:Table ID="tblGRMain" runat="server" style="text-align:left; background:Black; width:600px; height:100%;" >

                            <asp:TableRow>

                                <asp:TableCell Width="50%">

                                    <ig:WebHierarchicalDataSource ID="GRWebTreeData" runat="server">

                                    </ig:WebHierarchicalDataSource>

                                    <ig:WebDataTree ID="dtGRGroupsMain" runat="server" Width="100%" Height="300px"

                                        BackColor="White" EnableConnectorLines="True" AnimationEquationType="Linear" AnimationDuration="150" TabIndex="1" CssClass="ResizeControl">

                                    </ig:WebDataTree>

                                </asp:TableCell>

                                <asp:TableCell Width="50%">

                                    <ig:WebDataGrid ID="grdGRGroupsMain" runat="server" Style="width:100%; height:300px; min-height:300px;" TabIndex="2">

                                    </ig:WebDataGrid>

                                </asp:TableCell>

                            </asp:TableRow>

                        </asp:Table>

                    </div>

 

Parents
  • 5105
    Offline posted

    Hi there,

    Could you try and set different parents and child dataview IDs and the same parent and child columns in this code:

    dr.ParentDataViewID = "mainview"

    dr.ParentColumns = New String() {"GroupID"}

    dr.ChildDataViewID = "mainview"

    dr.ChildColumns = New String() {"UpGroupID"}

    Let me know if this brings the data back. Set parents and child columns to be "GroupID" and the view IDs to differ.

Reply Children
No Data