+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Roles and Navigation

Roles and Navigation

6 posts, 0 answered
  1. Pik Lee
    Pik Lee avatar
    142 posts
    Registered:
    13 Aug 2012
    27 Jul 2010
    Link to this post
    I have more than 200 roles created on my site and most users are assigned to more than one role. After the user successful log in, the user will come to a page with the navigation. In order to go to the desire page, the user needs to select the item from the navigation menu.

    For now, the navigation have about 50 items on it. The number of item on the navigation is depends on the user role. Some user can only see one item and some will see more than one item on the navigation menu. I am using SitePanelbar for the navigation. If the user has access to only one item on the navigation, I would like the user skip the navigation page and go to the page directly. Is that a way to accomplish this?

    Thanks,
    ~Pik

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    27 Jul 2010
    Link to this post
    Hi Pik Lee,

    You can subscribe for OnClientLoad event of the RadPanlelBar control and there get the items count. If the count equals to 1, redirect the user to its page

    sample code

    function OnClientLoad(sender) {
           if (sender != null) {
               var items = sender.get_items();
               if (items.get_count() ==  1) {
                   alert("you will be redirected to your page withing a second");
                   window.location = "http://www.google.com";
               }
           }
        
       }


    Regards,
    Ivan Dimitrov
    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
  3. Pik Lee
    Pik Lee avatar
    142 posts
    Registered:
    13 Aug 2012
    27 Jul 2010
    Link to this post
    Thanks for the prompt reply. Lets say i have the panel bar set up as follow. If the user has only access to one item in a category (example item1 in Category C). How do i direct the user to item1 page without take the user to the navigation page. Thanks ~Pik

    Category A
        item1
        item2
    Category B
        item1
        item2
    Category C
        item1
        item2
    Category D
        item1
        item2
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    27 Jul 2010
    Link to this post
    Hi Pik Lee,

    Get "Category C" as RadPanelItem and check its items. If the count is greater that 1 then this user has access to 2 or 3 child items.If the count equals to 1 then get this child RadPanelItem and make Response.Redirect to it.

    sample code

    RadPanelbar1.DataBind();
    // get only the root items - Category A, Category B etc.
    foreach (RadPanelItem itm in RadPanelbar1.Items)
    {
        if (itm.Items.Count == 1)
        {
           var child =  itm.Items[0] as RadPanelItem;
           Response.Redirect(child.NavigateUrl, true);
        }
    }


    Sincerely yours,
    Ivan Dimitrov
    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
  5. Pik Lee
    Pik Lee avatar
    142 posts
    Registered:
    13 Aug 2012
    02 Aug 2010
    Link to this post
    Thanks for the info. I am having problems to do the response.redirect with the following code. The itemURL display something like this:

    ~/ABC/pagegroup/C.aspx

    when I placed the itemURL in the response.redirect, it redirects to http://www.website.com/ABC

    foreach
    (RadPanelItem itm in RadPanelbar1.GetAllItems())
    {
        if (itm.Items.Count == 1)
        {
              string itemURL = itm.NavigateUrl();
          
    Response.Redirect(itemURL, true);
        }
    }

    Thanks, ~Pik
  6. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    03 Aug 2010
    Link to this post
    Hi Pik Lee,

    You should resolve the dynamic part first. Try with this one:

    string itemURL = itm.NavigateUrl();
    itemURL = this.ResolveUrl(itemURL);")
    Response.Redirect(itemURL, true);

    All the best,
    Georgi
    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
Register for webinar
6 posts, 0 answered