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

前端 未结 6 1091
花落未央
花落未央 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:17

    Wouldn't you be better off with

    
        Click here
    
    

    Because, to replicate your desired behavior on an asp:Button, you have to call window.open on the OnClientClick event of the button which looks a lot less cleaner than the above solution. Plus asp:HyperLink is there to handle scenarios like this.

    If you want to replicate this using an asp:Button, do this.

    
    

    JavaScript function.

    var windowObjectReference;
    
    function openRequestedPopup() {
        windowObjectReference = window.open("CMS_1.aspx",
                  "DescriptiveWindowName",
                  "menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes");
    }
    

提交回复
热议问题