Open menu item in new window

By default when you open a menu item based on your application's sitemap, it opens in the current window. To have items open in a new window, it's just a simple two step process. First add the "target" property to the sitemapnode you want to be opened in a new window:

 <siteMapNode url="http://gemini/Reports/Pages/Folder.aspx?ItemPath=/DMG" title="Reports" description="Reports" target="_blank"/>

Next add the following code to your master page (or whatever page your menu resides on):

Protected Sub mnDefault_MenuItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MenuEventArgs) Handles mnDefault.MenuItemDataBound

e.Item.Target = e.Item.DataItem("target")

End Sub

 

Published Thursday, March 26, 2009 9:31 AM by bunbun
Filed under:

Comments

No Comments

Leave a Comment

(required) 
(required) 
(optional)
(required)