RadTreeView not Binding

2 posts, 0 answers
  1. Muhammad
    Muhammad avatar
    87 posts
    Member since:
    Oct 2012

    Posted 04 Sep 2012 Link to this post

    Hi,

    I am trying to bind my RadTreeView control but for some reason the (+) sign is not coming with parent node to expand it and bind child nodes on server side.

     Any help would be really appreciated.

    Thanks

     
    <telerik:RadTreeView runat="Server" ID="rtvUserProducts" Height="300" Width="300"
                                        Skin="Vista">
                                        <Nodes>
                                            <telerik:RadTreeNode Expanded="true" Text="Parent" ExpandMode="ServerSide" runat="server">
                                                <NodeTemplate>
                                                    <asp:Label ID="lblProductName" Text='<%# Bind("ProductCodeAndDesc") %>' runat="server">
                                                    </asp:Label>
                                                    <asp:HiddenField ID="hidLogisticProductKey" Value='<%# Bind("LogisticProductKey") %>'
                                                        runat="server" />
                                                </NodeTemplate>
                                                <Nodes>
                                                    <telerik:RadTreeNode Expanded="true" Text="Child" ExpandMode="ServerSide">
                                                        <NodeTemplate>
                                                            <asp:Label ID="lblUserName" Text='<%# Bind("UserName") %>' runat="server"></asp:Label>
                                                        </NodeTemplate>
                                                    </telerik:RadTreeNode>
                                                </Nodes>
                                            </telerik:RadTreeNode>
                                        </Nodes>
                                    </telerik:RadTreeView>


     Protected Sub LoadProductsInTreeView()


            Dim oDataTable As New DataTable
            Dim oConn As New SqlConnection(SprintDB.GetStockSystemConnectionString)
            Dim sSQL As String
            Dim sb As New StringBuilder
            sb.Append("select distinct lp.LogisticProductKey, ProductDescription + ' (' + ProductCode + ')' 'ProductCodeAndDesc' from stockAlertRecipients sar inner join LogisticProduct lp on lp.LogisticProductKey = sar.Filter")
            sSQL = sb.ToString
            Dim oAdapter As New SqlDataAdapter(sSQL, oConn)
            Try
                oAdapter.Fill(oDataTable)
                rtvUserProducts.DataTextField = "ProductCodeAndDesc"
                rtvUserProducts.DataValueField = "LogisticProductKey"
                rtvUserProducts.DataFieldParentID = "LogisticProductKey"
                rtvUserProducts.DataSource = oDataTable
                rtvUserProducts.DataBind()
                rtvUserProducts.ExpandAllNodes()
            Catch ex As Exception
                WebMsgBox.Show(ex.Message.ToString)
            End Try


        End Sub
  2. Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 05 Sep 2012 Link to this post

    Hello Muhammad,

    I noticed that you didn't set the DataFieldID, which is needed when you are setting the DataFieldParentID in order to build the TreeView.

    I hope that helps.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top