Redirecting new tab on button click.(Response.Redirect) in asp.net C#

前端 未结 6 1093
花落未央
花落未央 2020-12-11 08:50

I\'m trying to open a page in new tab/window on button click.I tried in the google got this code but its not working.

Can anybody help me with this?

         


        
6条回答
  •  难免孤独
    2020-12-11 09:34

    This is what I ended up using. Temporarily sets target to _blank, then sets it back.

    OnClientClick="var originalTarget = document.forms[0].target; document.forms[0].target = '_blank'; setTimeout(function () { document.forms[0].target = originalTarget; }, 3000);"
    

提交回复
热议问题