Thursday, 11 June 2015

Open PopUp Window on the Button Click Event Using in Asp.Net C#

No comments    
categories: , , ,
Open PopUp Window

Click The Button Open The popup Window  Display Particular Size  and New Tab and Default Size Using  in Asp.Net C#.

                                  DEMO


Download Coding

                   Download



HTML CODING

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>

    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    <br />
    <br />
    <asp:Button ID="Button1" runat="server"  Text="Open Window Url" OnClick="Button1_Click" />
    <asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Open Without Size" />
    <asp:Button ID="Button3" runat="server" OnClick="Button3_Click" Text="Open New Browser" />
</div> 

</form>
</body>

</html>


C# CODING

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
      
    }
    protected void Button1_Click(object sender, EventArgs e)
    {

 // Small Size Window open

        TextBox1.Text = HttpContext.Current.Request.Url.AbsoluteUri;

        string popup = "window.open('" + TextBox1.Text + "','popup_window','left=200,top=100,width=100,height=100');";

        ClientScript.RegisterStartupScript(this.GetType(), "PopUp1", popup, true);

    }

    protected void Button2_Click(object sender, EventArgs e)
    {

 // Default Size Window open

        TextBox1.Text = HttpContext.Current.Request.Url.AbsoluteUri;

        string popup = "window.open('" + TextBox1.Text + "','','popup_window');";

        ClientScript.RegisterStartupScript(this.GetType(), "PopUp2", popup, true);

    }
    protected void Button3_Click(object sender, EventArgs e)
    {

 // New Tab Window open

        TextBox1.Text = HttpContext.Current.Request.Url.AbsoluteUri;

        string popup = "window.open('" + TextBox1.Text + "');";

        ClientScript.RegisterStartupScript(this.GetType(), "PopUp3", popup, true);

    }

}












0 comments:

Post a Comment