url attribute in MenuItem

Nov 26, 2008 at 2:40 AM
Hello,

I am trying to set my menu up to redirect users to different URLs based on the items that users click on.  However adding the MenuItem attribute Url="test.aspx" does not have any effect.  What am I missing?

Thanks,
Danny
Coordinator
Dec 1, 2008 at 4:18 PM
Danny, take a look at the PostBackRedirectMenu sample and SearchEngineFriendlyMenu sample and let me know if you still are stuck.
Dec 16, 2008 at 12:33 AM
I am having a similar problem, it doesn't seem to matter what I put int the Url attribute the menu always displays javascript:void(0);

here is my xml

<?xml version="1.0" encoding="utf-8" ?>
<MenuGroup>
     <MenuItem Text="Home" Width="70" AccessKey="H" CssClass="MenuItemLeft" />
     <MenuItem Width="90" Text="Take me to ServproNET" PostBack="True" Url="www.servpronet.com"/>
     <MenuItem Width="70" Text="Distributor Staff"/>
     <MenuItem Width="70" Text="Production"/>
     <MenuItem Width="80" Text="Office &amp; Administration"/>
     <MenuItem Width="70" Text="Sales &amp; Marketing"/>
     <MenuItem Width="80" Text="Owners &amp; Managers"/>
     <MenuItem Width="70" Text="E-Learning">
          <MenuGroup Width="150" ExpandDirection="Right" HorizontalOffset="2" VerticalOffset="-1">
               <MenuItem Width="150" Text ="Production">
                    <MenuGroup ExpandDirection="Right" HorizontalOffset="37" VerticalOffset="-1">
                         <MenuItem Width="150" Text="Carpet Cleaning" Url="http://servproadmin.brinkster.net/TrainER/CaptivateQuizes/Carpet/Carpet.asp"/>
                         <MenuItem Width ="150" Text="Carpet Cleaning (Spanisn)" Url="https://www.servpronet.com/users/training/trainer/instructions_carpetcleaningspn.htm"/>
                    </MenuGroup>
               </MenuItem>
          </MenuGroup>
     </MenuItem>
     <MenuItem Width="80" Text="Stages of Development"/>
     <MenuItem Width="70" Text="Resources"/>
</MenuGroup>





Coordinator
Jan 26, 2009 at 3:38 AM
When you set a Url that you want to have followed on the client, set PostBack=False. Please note thaat the default is True, so leaving it off will do a post back and not follow the Url if specified. Set PostBack="False", set the Url="whatever.aspx" and let me know if this doesn't do the trick.
Feb 24, 2009 at 9:26 AM
I have experienced another problem.
When you click the menu item on the text, the url does not work, you must click after the text
Coordinator
Mar 14, 2009 at 12:47 AM
Hmmm... Can you send me a code snipit that reproduces the error for me to look at?
Mar 27, 2009 at 10:27 AM
I have try PostBack="False" Url="www.microsoft.com" nothing happen (The result i would like is to have a new IE window that open to the Specified Url)
I have try PostBack="False" Url="MyPage.aspx" nothing happen again.
Please can you help

Thanks
Mar 27, 2009 at 3:30 PM
Edited Mar 27, 2009 at 3:32 PM
Sorry there was a "OnMenuItemClicked" attributes in the <SCS:MultiMenutag> so all the event where squeezed.
What are the parameters we can pass to the function in the OnClickClientCode attribute.
I would like for example to pass the Value of  the Tag attribute of the menuitem ?
Can you please help me
Many thanks
Apr 1, 2009 at 4:16 AM
Edited Apr 1, 2009 at 9:39 AM
HillPeacemen: [I have experienced another problem.
When you click the menu item on the text, the url does not work, you must click after the text ]

Hello HillPeacemen, I'm having this same issue now, if you fixed this, how did you do it?  I looked at my SCS:MultiMenu tag and I don't have the same OnClickClientCode attribute there.  Thanks!

edit:  Hmm, nevermind...the problems seems to have gone away but I have no idea how.  I'll post back if I get it again.  Sorry!

edit #2: Okay figured it out...the top level MenuItem needs to have PostBack="false" in it! If not, then you must click after the item title to get it follow the link specified in the Url attribute.
Coordinator
Apr 2, 2009 at 1:33 AM
Guys, I'll take a look at it and it would help me a lot if you could send me a project with an example of your problem isolated from the rest of your application. The OnClickClientCode is for runing a peice of JavaScript when clicking on a menu item instead of posting back or following a Url. If you use that property you will want to set PostBack=False and Url = "". The menu doesn't support opening new windows with a Url, but it can be done with the OnClickClientCode property and the appropriate JavaScript. The tag property of the menu item is only available on the server side and it cannot be accessed using client code. For examples of how to use OnClickClientCode property, see the ContextMenu sample and within it the MenuData3.xml file. 
Oct 29, 2009 at 2:49 PM
Edited Oct 29, 2009 at 2:53 PM
kevin_ccm wrote:
HillPeacemen: [I have experienced another problem.
When you click the menu item on the text, the url does not work, you must click after the text ]

Hello HillPeacemen, I'm having this same issue now, if you fixed this, how did you do it?  I looked at my SCS:MultiMenu tag and I don't have the same OnClickClientCode attribute there.  Thanks!

edit:  Hmm, nevermind...the problems seems to have gone away but I have no idea how.  I'll post back if I get it again.  Sorry!

edit #2: Okay figured it out...the top level MenuItem needs to have PostBack="false" in it! If not, then you must click after the item title to get it follow the link specified in the Url attribute.

 Kevin_ccm, you're time saver... yes, the trick is to set the parent menu to postback=false.  However this is not happening in 2.0, I'm not sure if 2.5 for VS2005 has the same issue but for sure it's true for 2.5 VS2008