Visual Basic - How to open a url on a new tab of browser in ASP.NET web forms?

532 views Asked by At

I'm trying to do an integration and I have a url. My ASPxButton is as follows:

<dx:ASPxButton ID="btn1" runat="server"
                    Text="Start Integration" Height="18px" Width="77px">
                    <FocusRectPaddings Padding="0px" />
                </dx:ASPxButton>

And my click event is as follows:

Protected Sub btn1_Click(sender As Object, e As EventArgs) Handles btn1.Click
        
    ......

    Dim urlForNewTab = "https://.../test.html?recordId=" + record.ToString + "&accessToken=" + token

    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "OpenWindow", "window.open('" & urlForNewTab & "');", True)

    'btn1.OnClientClick="javascript:window.open('" + urlForNewTab  + "');"

    'Response.Redirect(urlForNewTab )

End Sub

I tried many things but it didn't work? I tried to cancel reloading the page, it still didn't work.

1

There are 1 answers

0
ezgigokdemir On