link button property to open in new tab?

前端 未结 8 1311
野趣味
野趣味 2020-11-27 07:15

In my application I have some link buttons there but when I right click on them I cannot (they are in disable mode) find the menu items Open in new tab or

相关标签:
8条回答
  • 2020-11-27 08:13
    1. LinkButton executes HTTP POST operation, you cant change post target here.
    2. Not all the browsers support posting form to a new target window.
    3. In order to have it post, you have to change target of your "FORM".
    4. You can use some javascript workaround to change your POST target, by changing form's target attribute, but browser will give a warning to user (IE Does), that this page is trying to post data on a new window, do you want to continue etc.

    Try to find out ID of your form element in generated aspx, and you can change target like...

    getElementByID('theForm').target = '_blank' or 'myNewWindow'
    
    0 讨论(0)
  • 2020-11-27 08:20

    try by Adding following onClientClick event.

    OnClientClick="aspnetForm.target ='_blank';"

    so on click it will call Javascript function an will open respective link in News tab.

    <asp:LinkButton id="lbnkVidTtile1" OnClientClick="aspnetForm.target ='_blank';" runat="Server" CssClass="bodytext" Text='<%# Eval("newvideotitle") %>'  />
    
    0 讨论(0)
提交回复
热议问题