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

How to bind Treeview from stored procedure

2 Answers 71 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
asif
Top achievements
Rank 1
asif asked on 14 Jun 2010, 05:46 PM
I have table structured

Menu_Master :
PK    [MenuID] [int] IDENTITY(1,1) NOT NULL,
    [MenuName] [varchar](50) NOT NULL,
    [URL] [varchar](50) NULL,
    [ParentMenuID] [int] NULL,
 
If I have assign DataFieldParentId = ParentMenuID then TreeView goes blank just suggest me ..

2 Answers, 1 is accepted

Sort by
0
mohmedsadiq modan
Top achievements
Rank 1
answered on 15 Jun 2010, 08:10 AM
Hello asif,

use following code
                    tree.DataSource = Datatable

                   Dim Item As New RadTreeNodeBinding
                    item.NavigateUrl = "URL"

                    tree.DataBindings.Add(Item)
                    tree.DataTextField = "MenuName"
                    tree.DataValueField = "URL"
                    tree.DataFieldID = "MenuID"
                    tree.DataFieldParentID = "ParentMenuID"

                    tree.DataBind()


Regards,
sadiq
0
Accepted
Nikolay Tsenkov
Telerik team
answered on 15 Jun 2010, 09:55 AM
Hi asif,

Please, check if in the ParentMenuID you have records with null. I see that it's accepting that values, but maybe you don't have records without parentID.
If this is the case than you should set null for ParentMenuID for the records representing the root nodes.

Hope this is going to help you!


Regards,
Nikolay Tsenkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
TreeView
Asked by
asif
Top achievements
Rank 1
Answers by
mohmedsadiq modan
Top achievements
Rank 1
Nikolay Tsenkov
Telerik team
Share this question
or