Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2012
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    .Net Menu Control, Menu Item has a "/" in the title, causing exception

    Hi,

    In my list of menus on the .aspx page, I have a menu title that has a "/" in the title("Patient Selection/Worklist").

    ASPX Page:
    <asp:MenuItem Text="Tools" ToolTip="Tools">
    <asp:MenuItem Text="Patient Selection/Worklist" ToolTip="Patient Selection/Worklist" NavigateUrl="~/Web/PatientSelection.aspx"/>

    Code Behind Page:
    if (!_userSession.DbUser.IsPrimaryReviewerSomewhere)
    {
    MenuItem item = MainNavigationMenu.FindItem("Tools/Patient Selection/Worklist");
    item.Parent.ChildItems.Remove(item);

    On the code behind, I try and control if that menu item appears via the IF clause.
    It doesn't like the second "/" in the menu title and throws "Object reference not set to an instance of an object exception.
    I think that it interprets the 2nd "/" as another menu level("Tools/Patient Selection/Worklist")).
    I have tried using the special character (&#47) to escape out the 2nd "/", but it doesn't work.

    Any idea how to handle the 2nd / in the menu item title?


    Thank You in advance,

    Eric
    Last edited by pmcs; 03-21-2012 at 02:36 AM.

  • #2
    New to the CF scene
    Join Date
    Jan 2012
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Figured it out…



    You have to use pathseparator in the aspx page

    to designate the separation character in the code behind.



    <asp:menu id="NavigationMenu"

    staticdisplaylevels="2"

    staticsubmenuindent="10"

    orientation="Vertical"

    pathseparator=","

    runat="server">

    More info:

    http://msdn.microsoft.com/en-us/libr...separator.aspx

    Eric


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •