bind radgrid based on selected readtree node

2 posts, 0 answers
  1. beeta one
    beeta one avatar
    63 posts
    Member since:
    Aug 2012

    Posted 05 Nov 2012 Link to this post

    how can i bind radgrid based on the selected radtree node ?
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 05 Nov 2012 Link to this post

    Hi Hash,

    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.

Back to Top