How to open aspx web pages on a pop up window
Asked Answered
J

2

5

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.

Janinajanine answered 10/7, 2013 at 22:31 Comment(0)
M
9

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
Miserly answered 10/7, 2013 at 22:36 Comment(0)
S
0

Opening a web page or web form in modal popup window in ASP.NET is easy using jQuery:

$(function () {
        modalPosition();
        $(window).resize(function () {
            modalPosition();
        });
        $('.openModal').click(function (e) {
            $('.modal, .modal-backdrop').fadeIn('fast');
            e.preventDefault();
        });
        $('.close-modal').click(function (e) {
            $('.modal, .modal-backdrop').fadeOut('fast');
        });
    });
    function modalPosition() {
        var width = $('.modal').width();
        var pageWidth = $(window).width();
        var x = (pageWidth / 2) - (width / 2);
        $('.modal').css({ left: x + "px" });
    }

Refer to: open a web page in modal popup in asp.net using jquery

Scribbler answered 13/3, 2015 at 11:23 Comment(1)
The question is open the popup from server sideInstruct

© 2022 - 2024 — McMap. All rights reserved.