Rad Tree View with select

2 posts, 0 answers
  1. Raja
    Raja avatar
    3 posts
    Member since:
    Sep 2012

    Posted 26 Sep 2012 Link to this post

    Is there any samples for bind RadGridView based on selected RadTreeView

  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 27 Sep 2012 Link to this post

    Hi Raja,

    I suppose you want to bind the RadGrid based on the SelectedNode of RadTreeView. Here is the sample code that I tried.

    <telerik:RadTreeView ID="RadTreeView1" DataFieldID="id" DataFieldParentID="parent" DataSourceID="SqlDataSource1" DataTextField="name" DataValueField="id" runat="server" onnodeclick="RadTreeView1_NodeClick">
    <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource2" AutoGenerateColumns="true" Visible="false">
    <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" SelectCommand="SELECT * FROM tree" runat="server"></asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource2" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" runat="server"></asp:SqlDataSource>

    protected void RadTreeView1_NodeClick(object sender, Telerik.Web.UI.RadTreeNodeEventArgs e)
            string text = RadTreeView1.SelectedNode.Text;
            SqlDataSource2.SelectCommand = "select * from tree where name='" + text + "'";
            RadGrid1.Visible = true;

    Hope this helps.

  3. DevCraft R3 2016 release webinar banner
Back to Top