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

Binding Menu from Generic List

3 Answers 52 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Susi
Top achievements
Rank 1
Susi asked on 04 Sep 2012, 06:47 AM
Dear ALL,

how to bind menu from generic list that means i have method namely Public List<Roles> GetRoles() which is return list of roles every list contain properties are RoleID,RoleName,ParentRoleID,NavigateURL. 
 1) I need to bind menu based on this role name should be display with based on ParentRoleID heiarchy.
 2)And also i have NavigateURL property when i click RoleName in Menu based on NavigatURL my page will naviagte to another page     and how to implement this ? i am new to this if you guide me and very needful for me ..

Thanks in Advance..!

3 Answers, 1 is accepted

Sort by
0
Kevin
Top achievements
Rank 2
answered on 04 Sep 2012, 12:55 PM
Hello Susi,

Your code would look something like this:

radMenu1.DataTextField = "RoleName";
radMenu1.DataNavigateUrlField = "NavigateUrl";
radMenu1.DataFieldID = "RoleID";
radMenu1.DataFieldParentID = "ParentRoleID";
radMenu1.DataSource = GetRoles();
radMenu1.DataBind();

I hope that helps.
0
Susi
Top achievements
Rank 1
answered on 04 Sep 2012, 02:00 PM
Dear Kevin,
Thank you very much for your reply..Menu binding perfectly..But when i have bind above mentioned methodology all roles are listed in same line or category.how to resolve this..

There i have table like this

RoleID        RoleName       ParentRoleID    NavigateURL

  1             Intact                NULL                NULL
  2            User                      1                    NULL
  3            Project                  1                    NULL
  4            UserView              2                    UserView.aspx
  5            ProjectView          3                    ProjectView.aspx

Here I need bind menu based parentRoleID that means which parentRoleID is null that is want to placed in top level and another roles
are bind below based on heirarchy and also which have navigateURL that only navigate page to another page others no need and also
i have generic list method based on this table.

but when i have bind above mentioned methodology all roles are listed in same line or category.how to implement this..

Thanks in Advance...!
0
Kate
Telerik team
answered on 06 Sep 2012, 08:48 AM
Hi Susi,

Please take a look at the following demo of the RadMenu control where you can find a working example of binding a RadMenu control to a list - Hierarchical Data Binding

Greetings,
Kate
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Menu
Asked by
Susi
Top achievements
Rank 1
Answers by
Kevin
Top achievements
Rank 2
Susi
Top achievements
Rank 1
Kate
Telerik team
Share this question
or