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


    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.


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

     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)
                rtvUserProducts.DataTextField = "ProductCodeAndDesc"
                rtvUserProducts.DataValueField = "LogisticProductKey"
                rtvUserProducts.DataFieldParentID = "LogisticProductKey"
                rtvUserProducts.DataSource = oDataTable
            Catch ex As Exception
            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.
Back to Top