问题描述
大家好,
我的代码需要帮助.
我有 LinkButtons 的菜单栏和 MenuItems .根据要求,当用户右键单击MenuItems并选择在新选项卡中打开"或在新窗口中打开"时,我需要在新选项卡以及新窗口中打开链接(MenuItems)
问题是:当我选择任何MenuItem并单击以下任何在新标签中打开或在新窗口中打开时;它会在同一页面中打开,而不是在新标签页或窗口中打开.
Hi All,
I need help for my code.
I am having Menubars and MenuItems which are LinkButtons. As per requirement I need to open links(MenuItems) in new tab as well as on new windows when user RightClicks on the MenuItems and selects either "open in New Tab" or "open in New Window"
Problem is : When I select any MenuItem and click on any of these open in new tab or open in new window ; it opens in the same page rather than opening in new tab or window.
<li class="firstNav" ><a href="#" id ="regmenu">Register</a>
<ul class ="sub">
<li>
<asp:LinkButton ID ="lnkRegisterInvoice" runat ="server" Text ="Invoice" OnClick ="lnkRegisterInvoice_Click"></asp:LinkButton>
</li>
<li>
<asp:LinkButton ID ="lnkRegisterACInvoice" runat ="server" Text ="Article Charge Invoice" OnClick ="lnkRegisterACInvoice_Click"></asp:LinkButton>
</li>
<li>
<asp:LinkButton ID ="lnkRegisterCreditNote" runat ="server" Text ="Credit Note" OnClick ="lnkRegisterCreditNote_Click"></asp:LinkButton>
</li>
<li>
<asp:LinkButton ID ="lnkRegisterACCreditNote" runat ="server" Text ="Article Charge Credit Note" OnClick ="lnkRegisterACCreditNote_Click"></asp:LinkButton>
</li>
</ul>
</li>
任何建议,不胜感激:)
Any suggestion is appreciated :)
推荐答案
<asp:linkbutton id="lnkRegisterInvoice" runat="server" text="Invoice" onclick="window.open('registerinvoice.aspx');return false;" ></asp:linkbutton>
如果以上条件不符合您的要求,您可以随时尝试以下方法:
If the above doesn''t meet your requirement you could always try the following:
<a href="RegisterInvoice.aspx" target="_blank">Invoice</a>
这篇关于如何使用右键单击从LinkButton在新选项卡和窗口中打开链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!