Outlook navigation with items removed

4 posts, 0 answers
  1. Kurt Kluth
    Kurt Kluth avatar
    144 posts
    Member since:
    Oct 2009

    Posted 26 Feb 2014 Link to this post

    I have implemented the following code as it is mimics the functionality that I am looking for, however need it changed slightly.  The PanelBar may have certain items hidden based upon permissions.  ie. Admin may see all menu items; where a guest will only see few; employee will see most.  Using this code when clicking on "CU Tracking" it will not display any information because it is looking to show the information for RadPageView2 instead of RadPageView3.  Clicking on "Reporting Tools" will show RadPageView3. 

    I plan on using code behind to limit the items visible within the PanelBar based upon permissions.  But I would like it only to display appropriate RadPageView first.   

    Any suggestions?
           <telerik:RadSplitter ID="RadSplitter1" runat="server" Height="100%" Width="100%">
                <telerik:RadPane runat="server" ID="leftpane" Width="250">
                    <telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0" Height="70%" Width="235" BackColor="White" BorderColor="#6593cf" BorderStyle="Solid" BorderWidth="1px">
                    <telerik:RadPageView ID="RadPageView1" runat="server">
                        <h2>Home</h2>
                   </telerik:RadPageView>
                    <telerik:RadPageView ID="RadPageView2" runat="server" Visible="false" Enabled="false">
                        <h2>Financial Statements</h2>
                        <ul class="qsfexOtherItems">
                             <li>
                                <span class="qsfexLinkImage"><asp:Image ID="Image1" runat="server" ImageUrl="images/fs_XML-icon.png" AlternateText="Data Entry"></asp:Image></span>
                                <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="#">Data Entry</asp:HyperLink>
                             </li>
                             <li>
                                 <span class="qsfexLinkImage"><asp:Image ID="Image2" runat="server" ImageUrl="images/fs_Data-Upload-icon.png" AlternateText="Data Entry"></asp:Image></span>
                                 <asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl="#">Data Upload</asp:HyperLink>
                             </li>
                        </ul>
                   </telerik:RadPageView>
                    <telerik:RadPageView ID="RadPageView3" runat="server">
                        <h2>CU Tracking</h2>
                        <ul class="qsfexOtherItems">
                            <li>
                                <span class="qsfexLinkImage"><asp:Image ID="Image3" runat="server" ImageUrl="images/CT_ContactMgr-icon.png" AlternateText="Contact Manager"></asp:Image></span>
                                <asp:HyperLink ID="HyperLink3" runat="server" NavigateUrl="CUTracking/ContactManager">Contact Manager</asp:HyperLink>
                            </li>
                            <li><asp:HyperLink ID="HyperLink4" runat="server" NavigateUrl="#">Policy Information</asp:HyperLink></li>
                            <li><asp:HyperLink ID="HyperLink11" runat="server" NavigateUrl="#">Auditing</asp:HyperLink></li>
                            <li><asp:HyperLink ID="HyperLink12" runat="server" NavigateUrl="#">Excess Tracking</asp:HyperLink></li>
                            <li><asp:HyperLink ID="HyperLink13" runat="server" NavigateUrl="#">Misc Information</asp:HyperLink></li>
                            <li>
                                <span class="qsfexLinkImage"><asp:Image ID="Image10" runat="server" ImageUrl="images/notesItems.gif" AlternateText="Notes"></asp:Image></span>
                                <asp:HyperLink ID="HyperLink14" runat="server" NavigateUrl="#">Notes</asp:HyperLink></li>
                            <li><asp:HyperLink ID="HyperLink15" runat="server" NavigateUrl="#">Board Reporting</asp:HyperLink></li>
                        </ul>
                   </telerik:RadPageView>
                    <telerik:RadPageView ID="RadPageView4" runat="server">
                        <h2>Reporting Tools</h2>
                        <ul class="qsfexOtherItems">
                            <li><asp:HyperLink ID="HyperLink5" runat="server" NavigateUrl="#">Static Reports</asp:HyperLink></li>
                            <li><asp:HyperLink ID="HyperLink6" runat="server" NavigateUrl="#">Policy Letters</asp:HyperLink></li>
                            <li><asp:HyperLink ID="HyperLink16" runat="server" NavigateUrl="#">CU Data Bank</asp:HyperLink></li>
                            <li><asp:HyperLink ID="HyperLink17" runat="server" NavigateUrl="#">Labels</asp:HyperLink></li>
                        </ul>
                   </telerik:RadPageView>
                    <telerik:RadPageView ID="RadPageView5" runat="server" Visible="false">
                        <h2>Check Mate</h2>
                        <ul class="qsfexOtherItems">
                            <li><asp:HyperLink ID="HyperLink7" runat="server" NavigateUrl="#">Admin Tools</asp:HyperLink></li>
                            <li><asp:HyperLink ID="HyperLink8" runat="server" NavigateUrl="#">Contact Manager</asp:HyperLink></li>
                            <li><asp:HyperLink ID="HyperLink18" runat="server" NavigateUrl="#">Contact Processing</asp:HyperLink></li>
                            <li>
                                <span class="qsfexLinkImage"><asp:Image ID="Image20" runat="server" ImageUrl="images/notesItems.gif" AlternateText="My Contacts">
                                </asp:Image></span><asp:HyperLink ID="HyperLink19" runat="server" NavigateUrl="#">Notes</asp:HyperLink>
                            </li>
                            <li><asp:HyperLink ID="HyperLink20" runat="server" NavigateUrl="#">Reports</asp:HyperLink></li>
                        </ul>
                   </telerik:RadPageView>
                    <telerik:RadPageView ID="RadPageView6" runat="server" Visible="false">
                        <h2>Administration</h2>
                        <ul class="qsfexOtherItems">
                            <li><asp:HyperLink ID="HyperLink9" runat="server" NavigateUrl="#">User Administration</asp:HyperLink></li>
                        </ul>
                   </telerik:RadPageView>
              </telerik:RadMultiPage>
                    <hr class="separator" />
                    <telerik:RadPanelBar runat="server" ID="RadPanelBar1" ExpandMode="SingleExpandedItem" OnClientItemClicking="OnClientItemClicking" OnClientMouseOver="panelMouseOver" Width="235px">
                        <Items>
                            <telerik:RadPanelItem Text="Home" Expanded="True" ImageUrl="images/home-icon.png" />
                            <telerik:RadPanelItem Text="Financial Statements" Expanded="True" ImageUrl="images/dollar-sign-icon.png" Visible="false" />
                            <telerik:RadPanelItem Text="CU Tracking" Expanded="True" ImageUrl="images/CUTracking-icon.png" />
                            <telerik:RadPanelItem Text="Reporting Tools" Expanded="True" ImageUrl="images/Reporting-icon.png" />
                            <telerik:RadPanelItem Text="Check Mate" Expanded="True" ImageUrl="images/check-mate-icon.png" Visible="false" />
                            <telerik:RadPanelItem Text="Administration" Expanded="True" ImageUrl="images/Administration-icon.png" Visible="false" />
                        </Items>
                        <ExpandAnimation Type="OutQuart" />
                        <CollapseAnimation Type="OutQuart" />
                    </telerik:RadPanelBar>
                </telerik:RadPane>
     
    </telerik:RadSplitter>
         <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
              <script type="text/javascript">
                  //<![CDATA[
                  var blnDragging = false;
                  function OnClientItemClicking(sender, eventArgs) {
                      var multipage = $find("<%= RadMultiPage1.ClientID %>");
                       multipage.set_selectedIndex(eventArgs.get_item().get_index());
                  }
                  function panelMouseOver(sender, eventArgs) {
                      if (eventArgs.get_item().get_text().indexOf("Folders") != -1 && blnDragging) {
                          var multipage = $find("<%= RadMultiPage1.ClientID %>");
                            multipage.set_selectedIndex(eventArgs.get_item().get_index());
                        }
                    }
                  //]]>
              </script>
         </telerik:RadScriptBlock>
  2. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 03 Mar 2014 Link to this post

    Hi Kurt,

    I'm not sure what exactly is your scenario, but I think you should hide both PageViews and PanelBarItems, based on the user permissions. To do that handle the page's OnInit event:

    protected override void OnInit(EventArgs e)
    {
        if (!User.IsInRole("Admin"))
        {
            RadMultiPage1.PageViews[0].Visible = false;
            RadPanelBar1.Items[0].Visible = false;
        }
    }


    Regards,
    Hristo Valyavicharski
    Telerik
    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 UI for ASP.NET AJAX, subscribe to the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Kurt Kluth
    Kurt Kluth avatar
    144 posts
    Member since:
    Oct 2009

    Posted 04 Mar 2014 in reply to Hristo Valyavicharski Link to this post

    Hristo,

    The code does work in hiding them however when clicking on a visible PanelBar item it won't show the appropriate menu.  I believe the javascript maybe the problem.  If I have a "guest" user, they should see "Home, CU Tracking, Reporting Tools", when clicking on "CU Tracking" no pageview shows; when clicking "Reporting Tools", it shows CU Tracking pageview.

    This is the Example I was using.
  5. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 07 Mar 2014 Link to this post

    Well, in this case I suppose that you have some logic to associate pageviews with panelbar items and user roles. To show the correct pageview corresponding to the clicked item use the following code:

    function OnClientItemClicking(sender, eventArgs) {
        debugger
        var multipage = $find("<%= RadMultiPage1.ClientID %>");
     
        //Find pageView by ID
        var pageView = multipage.findPageViewByID("RadPageView6");
        //Select select the appropriate pageView
        pageView.selelect();
    }

    It allow you to find and select page view by id.

    I hope this helps.

    Regards,
    Hristo Valyavicharski
    Telerik

    DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

Back to Top