Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open aspx web pages on a pop up window

I'm trying to write a code to open an .aspx (in shape of a pop up window) after clicking a LinkButton on another .ASPX web page(using VB)

Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs)      Handles LinkButton1.Click

    'What code?

End Sub

Not sure how to do it, I can't find a popup control or something similar.

like image 221
phalanx Avatar asked Jul 10 '13 22:07

phalanx


1 Answers

You can use ClientScript.RegisterStartupScript

In C#

protected void Button1_Click(object sender, EventArgs e)
{
    string queryString = "test.aspx" ;
    string newWin ="window.open('" + queryString + "');";
    ClientScript.RegisterStartupScript(this.GetType(), "pop", newWin, true);
}

In VB

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs)

        Dim queryString As String = "test.aspx" 
        Dim newWin As String = "window.open('" & queryString & "');"
        ClientScript.RegisterStartupScript(Me.GetType(), "pop", newWin, True)

End Sub
like image 108
Ozan Deniz Avatar answered Oct 24 '22 01:10

Ozan Deniz