In my table I have columns named Ques, Answer, ID, etc. If I want to display these question answers on my page using RadTreeView, how do I implement this ? Like I want the parent node in the TreeView to be the question and child node should be the answer. Any sample code for that in here ?
1 Answer, 1 is accepted
0
Nikolay Tsenkov
Telerik team
answered on 20 Dec 2010, 12:44 PM
Hello gs1711,
You can not directly bind the table to treeView. You need to change the relation a little bit. For example you can create a table with the following structure:
- Column: Id (primary key, int);
- Column: ParentId (foreign key pointing to the Id of the same table, int, but nullable - the root nodes need to have null for this column);
- Column: Text (varChar(x), the text that the node should display - i.e. question or answer).
Then having this table you can bind it to the TreeView as follows: