By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,403 Members | 855 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,403 IT Pros & Developers. It's quick & easy.

Can menu items open new windows?

P: n/a
Hi all,
how can I use menu object to open a new window instead of postback to
the same page where the menu is? What I'd like to do is like invoking
"window.open()" (javascript) from a menu item.

Thanks in advance

Nov 20 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
<ce*****@libero.itwrote in message
news:11**********************@k70g2000cwa.googlegr oups.com...
how can I use menu object to open a new window instead of postback to
the same page where the menu is? What I'd like to do is like invoking
"window.open()" (javascript) from a menu item.
http://msdn2.microsoft.com/en-us/lib...et(VS.80).aspx
Nov 20 '06 #2

P: n/a
You can do that by setting the NavigateUrl property to a javascript function
that opens the new window
<asp:Menu ID="Menu1" runat="server">

<Items>

<asp:MenuItem Text="Javascript Menu" Value="Javascript Menu"
NavigateUrl="javascript:openWin();" Target="_self"></asp:MenuItem>

</Items>

</asp:Menu>

<script language=javascript>

function openWin()

{

window.open('Default.aspx');

}

</script>

hope this helps

"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:Oa**************@TK2MSFTNGP03.phx.gbl...
<ce*****@libero.itwrote in message
news:11**********************@k70g2000cwa.googlegr oups.com...
>how can I use menu object to open a new window instead of postback to
the same page where the menu is? What I'd like to do is like invoking
"window.open()" (javascript) from a menu item.

http://msdn2.microsoft.com/en-us/lib...et(VS.80).aspx

Nov 20 '06 #3

P: n/a
"Onwuka Emeka" wrote:
You can do that by setting the NavigateUrl property to a javascript function
that opens the new window
<asp:Menu ID="Menu1" runat="server">
<Items>
<asp:MenuItem Text="Javascript Menu" Value="Javascript Menu"
NavigateUrl="javascript:openWin();" Target="_self"></asp:MenuItem>
</Items>
</asp:Menu>
Can you not just set the target to _blank?

<asp:MenuItem Text="Test Menu" Value="Test Menu"
NavigateUrl="SomePage.aspx" Target="_blank"></asp:MenuItem>

Nov 20 '06 #4

P: n/a
"Leon Mayne" <Le*******@discussions.microsoft.comwrote in message
news:3B**********************************@microsof t.com...
Can you not just set the target to _blank?
Yes:
http://msdn2.microsoft.com/en-us/lib...et(VS.80).aspx
Nov 20 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.