Pass node text to sqldatasource select statement

3 posts, 0 answers
  1. Stavros
    Stavros avatar
    89 posts
    Member since:
    Sep 2008

    Posted 22 Jun 2009 Link to this post

    I am using a treeview with 3 levels of nodes (in the masterpage)
    I want to pass the e.Node.Text variable when the user is clicking a node using the code behind method

    RadTreeView1_NodeClick
    to the sqldatasource select statement that resides in radgrid that is placed the page that uses the above master page.
    Any ideas on how to do that? 

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 23 Jun 2009 Link to this post

    Hi Stavros,

    Try the following code to access control placed in ContentPlaceHolder.

    CS:
     
    protected void RadTreeView1_NodeClick(object sender, Telerik.Web.UI.RadTreeNodeEventArgs e)  
    {  
        ContentPlaceHolder mpContentPlaceHolder = default(ContentPlaceHolder);  
        // Get a reference to the contentPlaceHolder   
        mpContentPlaceHolder = (ContentPlaceHolder)FindControl("ContentPlaceHolder1");  
        // Use FindControl to get a reference to a SqlDataSource   
        SqlDataSource Sqldatasource = (SqlDataSource) mpContentPlaceHolder.FindControl("SqlDataSource1"); 
        // Set the SelectCommand of sqldatasource     
    }  
    Feel free to share the comments.

    Thanks,
    Shinu
  3. Stavros
    Stavros avatar
    89 posts
    Member since:
    Sep 2008

    Posted 24 Jun 2009 Link to this post

    The select command is already in place in the content page.
    I just want to pass the value of the node when it is clicked to the where column1 = node.value.
    Is this possible?
    Thank you very much for your help!
Back to Top