LinkButton: Open link in a new window (Right-click)

0

I would like to know if there is any way I can open a new tab by right-clicking or a middle mouse button ...

I am using " LinkButton " but the command occurs within OnItemCommand="ListaMenu_ItemCommand ". Aspx:

<asp:Repeater ID="ListaMenu" runat="server" 
                                 OnItemCommand="ListaMenu_ItemCommand">
                                 <ItemTemplate>                                      
                                            <li><asp:LinkButton ID="LknMenu" runat="server" Text='<%#Eval("NOMTIPPRO").ToString()%>' ToolTip ='<%#Eval("CODTIPPRO").ToString()%>' target="_blank"> 
                                                </asp:LinkButton>
                                            </li>
                                 </ItemTemplate>
                        </asp:Repeater>

Aspx.cs:

protected void ListaMenu_ItemCommand(object source, RepeaterCommandEventArgs e)
{
    LinkButton lnkId = (LinkButton)e.Item.FindControl("LknMenu");
    Response.Redirect("~/KnPesquisa.aspx?knMnuTipo=Tipo&knMnuCodTipo=" + lnkId.ToolTip);
}
    
asked by anonymous 17.07.2017 / 16:12

3 answers

2

You can use the OnClientClick event or the asp: HyperLink control

OnClientClick="window.open('OtherPage.aspx', 'PageName');"
    
17.07.2017 / 20:08
0

Resolved !!!

Follow the code used.

Aspx:

<asp:Repeater ID="ListaMenu" runat="server" >
                                     <ItemTemplate>                                      
                                                <li><asp:LinkButton ID="LknMenu" runat="server" Text='<%#Eval("NOMTIPPRO").ToString()%>' ToolTip ='<%#Eval("CODTIPPRO").ToString()%>' 
                                                         href='<%#"KnPesquisa.aspx?knMnuTipo=Tipo&knMnuCodTipo=" + Eval("CODTIPPRO") %>'>
                                                    </asp:LinkButton>
                                                </li></ItemTemplate></asp:Repeater>
    
17.07.2017 / 19:27
-2

You can use the code below:

OnClientClick="window.open('OtherPage.aspx', 'PageName');"
    
19.07.2017 / 19:54