Binding Menu from Generic List

4 posts, 0 answers
  1. Susi
    Susi avatar
    40 posts
    Member since:
    Jul 2012

    Posted 04 Sep 2012 Link to this post

    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..!
  2. Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 04 Sep 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Susi
    Susi avatar
    40 posts
    Member since:
    Jul 2012

    Posted 04 Sep 2012 Link to this post

    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...!
  5. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 06 Sep 2012 Link to this post

    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.
Back to Top