This is a migrated thread and some comments may be shown as answers.

Pass node text to sqldatasource select statement

2 Answers 37 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Stavros
Top achievements
Rank 1
Stavros asked on 22 Jun 2009, 03:06 PM
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 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 23 Jun 2009, 02:06 PM
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
0
Stavros
Top achievements
Rank 1
answered on 24 Jun 2009, 09:58 AM
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!
Tags
TreeView
Asked by
Stavros
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Stavros
Top achievements
Rank 1
Share this question
or