I was able to get window.open to work, as well as target='_blank'. Try this:
For target - In your web.sitemap file, add an XML attribute called "target".
(<siteMapNode title="Durham" url="http://www.website.com/Durham.pdf"
pop_up="" target="_blank"/>) This attribute is not required for every node.
For window.open - In your web.sitemap file, add an XML attribute called
"pop_up". You will have to add this to every node that contains a "URL"
attribute. Set to "" when using a URL, set to the url when using pop_up. URL
attribute must have a value.
(<siteMapNode title="Durham" url="duh" pop_up_width="210"
pop_up_height="210" pop_up="http://www.website.com/Durham.pdf"/>)
Optionally you can set a height and width attribute in your web.sitemap file.
Then in your code...
protected void Menu1_MenuItemDataBound(object sender, MenuEventArgs e)
{
e.Item.Target = ((SiteMapNode)(e.Item.DataItem))["target"];
if (((SiteMapNode)(e.Item.DataItem))["pop_up"] != "")
{
e.Item.NavigateUrl = "javascript
:OpenWindow('" +
((SiteMapNode)(e.Item.DataItem))["pop_up"] + "'," +
((SiteMapNode)(e.Item.DataItem))["pop_up_width"] + "," +
((SiteMapNode)(e.Item.DataItem))["pop_up_height"] + ")";
}
}
You will need to add this to your .aspx file...
<script language="javascript">
function OpenWindow(URL,W,H)
{
var WindowName = "MyPopup";
var Features = "width=" + W + ",height=" + H + ",location=no,
toolbar=no, menubar=no, resizable";
window.open(URL, WindowName, Features);
}
</script>
and lastly - add this to your <asp:Menu tag...
OnMenuItemDataBound="Menu1_MenuItemDataBound"
"Joe" wrote:
I have a web.sitemap file that has the url title and description. I then
have this attac attached to a menu. I want some of my menu choices to open
up in a page in a new window ie _blank as target. How do I do this with a
web.sitemap file