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

[Solved] Have two columns of the Dataset bind to the text field of a node

2 Answers 116 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Rishi
Top achievements
Rank 1
Rishi asked on 26 Feb 2010, 05:46 PM
Hi

I need to have the values of two columns say FirstName and LastName of a data table containing information about employees show up as FirstName,LastName on the node text field in the Tree View while I bind the data set to the tree view. Is there a way to do that?
Thanks

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 01 Mar 2010, 06:19 AM
Hello Harisha,

You can try the following code snippet in order to change the node text according to the second field value.

C#:
 
    protected void RadTreeView1_NodeDataBound(object sender, Telerik.Web.UI.RadTreeNodeEventArgs e) 
    { 
        DataRowView row = (DataRowView)e.Node.DataItem; 
        string str = row["LastName"].ToString(); 
        e.Node.Text = e.Node.Text +", "+ str; 
    } 

-Shinu.
0
Rishi
Top achievements
Rank 1
answered on 08 Mar 2010, 08:32 PM
Thanks Shinu,

I didn't try it yet but it sure makes sense.
Tags
TreeView
Asked by
Rishi
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Rishi
Top achievements
Rank 1
Share this question
or