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

Roles and membership

8 Answers 155 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Andy Green
Top achievements
Rank 1
Andy Green asked on 26 Jun 2008, 01:05 PM
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

8 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 26 Jun 2008, 02:13 PM
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
0
Andy Green
Top achievements
Rank 1
answered on 26 Jun 2008, 02:35 PM
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
0
Andy Green
Top achievements
Rank 1
answered on 07 Jul 2008, 01:36 PM
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
0
Atanas Korchev
Telerik team
answered on 07 Jul 2008, 01:41 PM
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
0
Andy Green
Top achievements
Rank 1
answered on 07 Jul 2008, 01:45 PM
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
0
Atanas Korchev
Telerik team
answered on 07 Jul 2008, 01:50 PM
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
0
Andy Green
Top achievements
Rank 1
answered on 09 Jul 2008, 11:02 AM
Thanks for these, but they dont show the use of sitemapdatasource.

How do I add images.

Andy
0
Atanas Korchev
Telerik team
answered on 09 Jul 2008, 12:34 PM
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
Tags
ToolBar
Asked by
Andy Green
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Andy Green
Top achievements
Rank 1
Share this question
or