Click here to Skip to main content
15,900,906 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I developed a webpage using asp.net 2008. I have used aps:menu to link other pages. The links are opened properly. But my problem is, when I right click on any link in the menu, "open in a new tab" and "open in a new window" options are disabled. How to enable this? My code follows


XML
<asp:Menu ID="Menu3" runat="server" Font-Bold="True" Font-Names="Calibri"
           Font-Size="Small" ForeColor="#000099" Orientation="Horizontal"
               style="position:absolute ;  z-index: 5; left: 750px; top: 5px;  height: 28px;
           width: 200px; text-align: center;">
           <StaticSelectedStyle Font-Underline="True" ForeColor="Black" />
           <StaticHoverStyle ForeColor="#FF0066"  Font-Bold="True" />
           <Items>
               <asp:MenuItem SeparatorImageUrl="~/images/MenuSplitBar.jpg" Text="Home"
                   Value="Home">
               </asp:MenuItem>
               <asp:MenuItem SeparatorImageUrl="~/images/MenuSplitBar.jpg" Text=" Enquiry"
                   Value=" Enquiry"  ></asp:MenuItem>
               <asp:MenuItem Text="Service Request"
                   Value="ServiceRequest"></asp:MenuItem>
           </Items>
       </asp:Menu>


I am using vb to write linksto the menu. the code as follows

VB
Protected Sub Menu3_MenuItemClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MenuEventArgs) Handles Menu3.MenuItemClick
       Select Case e.Item.Value
           Case "Home"
               Response.Redirect("Default.aspx")
           Case " Enquiry"
               Response.Redirect("Enquiry.aspx")
           Case "ServiceRequest"
               Response.Redirect("ServiceRequest.aspx")
       End Select
   End Sub


Kindly help me to solve thias problem.
Posted

You can use property Target="_blank" to open in new window.

Sample one here MenuItem.Target Property[^]
 
Share this answer
 
v2
Comments
Dalek Dave 18-Nov-10 4:23am    
Simple answer, but effective.
thatraja 18-Nov-10 4:46am    
Good answer & just added a ref link in yours
GrowingTech 18-Nov-10 6:03am    
Thank You so much.
XML
string url = "URL.aspx";
HttpContext.Current.Response.Write("<SCRIPT LANGUAGE='JavaScript'>window.open('" + url + "', '_new');</SCRIPT>");
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900