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

binding to sqldatasource - URGENT Pls help me

1 Answer 67 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Abdul Kadar
Top achievements
Rank 1
Abdul Kadar asked on 18 Jan 2009, 01:24 PM
Hi .,
I want to bind a treeview with sql datasource.I use the below code.Pls guide me how to use parentid (I am using asp.net with vb)

 

<telerik:RadTreeView ID="RadTreeView1" runat="server" DataSourceID="SqlDataSource1" DataTextField="DESCRIPTION" DataValueField="CODE"></telerik:RadTreeView>
Using the above code, I got the output as 
                            

 

o   Scanner ( description)

o   Printer   ( description)

o   Laptop   ( description)

      o   Cute FTp  ( description)

o   Logmein  ( description

Below is sql select query

 

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:EsteeConnectionString %>"

 

 

SelectCommand="SELECT [CODE], [DESCRIPTION],[MAINCATEGORY] FROM [BRANDMASTER]"></asp:SqlDataSource>

 


I need the output as follows:

Ø  Hardware     ( maincategory )

o   Scanner ( description)

o   Printer   ( description)

o   Laptop   ( description)

Ø  Software   (maincategory)

o   Cute FTp  ( description)

o   Logmein  ( description)

 




1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 19 Jan 2009, 09:47 AM
Hi Abdul,

Go through the following help articles which explain how to implement a hierarchical type of data-binding with TreeView. See how the DataFieldID and DataFieldParentID properties are used to set the DataBase relation.
SqlDataSource or AccessDataSource
Binding to a Database

Thanks,
Shinu.
Tags
TreeView
Asked by
Abdul Kadar
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or