Roles and membership

9 posts, 0 answers
  1. Andy Green
    Andy Green avatar
    5 posts
    Member since:
    Jun 2008

    Posted 26 Jun 2008 Link to this post

    How do I include role & membership to the ToolBar control (The same also applied to the menu & Tab controls).

    I want to hide & show items based on the users security role.

    Regards
    Andy
  2. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 26 Jun 2008 Link to this post

    Hello Andy Green,

    We recommend using the SiteMapDataSource and the security trimming feature. This approach should work with all RadControls which support binding to SiteMapDataSource (toolbar, menu, tabstrip etc).

    If you are using custom implementation of users and roles you need to programmatically remove or hide the items which should not be visible.

    Regards,
    Albert
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Andy Green
    Andy Green avatar
    5 posts
    Member since:
    Jun 2008

    Posted 26 Jun 2008 Link to this post

    Thanks Albert

    I did try that, but could not get the control to show sub menus, so assumed I was doing things wrong. Now I know it's the way to go I'll re visit the sitemapdatasource.

    Andy
  5. Andy Green
    Andy Green avatar
    5 posts
    Member since:
    Jun 2008

    Posted 07 Jul 2008 Link to this post

    Hi, Sorry for letting this go cold, but just gotten back on it.

    I cant get the toolbar to read the sitemap file. It reads the top level, but none of ther sub nodes.

    I have tested it with every other nav control and it works, so why not with the toolbar.

    Andy
  6. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 07 Jul 2008 Link to this post

    Hi Andy Green,

    At the time being RadToolBar does not support hierarchical databinding from sitemap datasource. I suggest you use RadMenu as it is more suitable to create website navigation.

    Regards,
    Albert
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  7. Andy Green
    Andy Green avatar
    5 posts
    Member since:
    Jun 2008

    Posted 07 Jul 2008 Link to this post

    How does this answer my original post:

    How do I include role & membership to the ToolBar control (The same also applied to the menu & Tab controls).

    I want to hide & show items based on the users security role.How do I include role & membership to the ToolBar control (The same also applied to the menu & Tab controls).

    I want to hide & show items based on the users security role.

    I take it I cant.

    If I use RadMenu, are therte examples of using images for the menu item?

    Andy
  8. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 07 Jul 2008 Link to this post

    Hi Andy Green,

    RadToolbar can databind only to top level items from the sitemap. Security trimming should work as long as it is applied for top level sitemap items.

    You can use images for the menu item by setting the ImageUrl property. You can check our online examples:
    http://www.telerik.com/demos/aspnet/prometheus/Menu/Examples/Default/DefaultCS.aspx
    http://www.telerik.com/demos/aspnet/prometheus/Menu/Examples/Appearance/ImageOnly/DefaultCS.aspx

    I hope this helps,
    Albert
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  9. Andy Green
    Andy Green avatar
    5 posts
    Member since:
    Jun 2008

    Posted 09 Jul 2008 Link to this post

    Thanks for these, but they dont show the use of sitemapdatasource.

    How do I add images.

    Andy
  10. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 09 Jul 2008 Link to this post

    Hello Andy Green,

    You can use custom sitemap attributes to define the images:

    <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
      <siteMapNode title="All Sites" >
        <siteMapNode title="Search Engines" image="Images/11new.gif" >
          <siteMapNode url="http://yahoo.com" title="Yahoo"  description="Yahoo" image="Images/11new.gif"/>
          <siteMapNode url="http://msn.com" title="MSN"  description="MSN" image="Images/11new.gif"/>
          <siteMapNode url="http://www.google.com" title="Google"  description="Google Search" image="Images/11new.gif"/>
        </siteMapNode>
    </siteMap>

    Then you should subscribe to the ItemDataBound event of the menu and set the ImageUrl property:

            protected void RadMenu1_ItemDataBound(object sender, RadMenuEventArgs e)
            {
                SiteMapNode node = (SiteMapNode)e.Item.DataItem;
                string image = node["image"];
                if (!string.IsNullOrEmpty(image))
                {
                    e.Item.ImageUrl = image;
                }
            }

    I hope this helps,
    Albert
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017