Click here to Skip to main content
12,621,302 members (28,949 online)
Click here to Skip to main content
Add your own
alternative version

Stats

173.5K views
9.8K downloads
20 bookmarked
Posted

Popup Control for ASP.NET

, 25 Oct 2013 CPOL
Rate this:
Please Sign up or sign in to vote.
Easiest way to implement popup window in ASP.NET

Introduction

This tip demonstrates how to implement a movable Popup window in ASP.NET. A very important feature of this control is that it can be used on most of the current browsers. It has been tested with the latest version of Mozilla, Internet Explorer, and Opera.

Background

Most of the time, developers face the problem in popup windows to automatically a hide popup window after a post back event because they use AJAX controls. In this tip, I provide you with an easy way to implement a popup window in ASP.NET without writing too much code.

Implementation

On Page design

There is very little coding necessary to implement a popup control. First, you need to add DDL in your project. And register assembly in your page by using the following code:

<%@ Register Assembly="ASP.Web.UI.PopupControl" 
    Namespace="ASP.Web.UI.PopupControl"
    TagPrefix="ASPP" %>  

After that, declare the control in the Page design (.Aspx). Whatever you want to show as popup, put into the PopupWindow tag in the following way:

<ASPP:PopupPanel HeaderText="This is Header" ID="pup" 
          runat="server" OnCloseWindowClick="MycloseWindow">
    <PopupWindow runat="server">
        <ASPP:PopupWindow ID="PopupWindow1" 
        Visible="false" runat="server">
            <asp:Label ID="lbl" runat="server">ssssssssss</asp:Label>
            <br />
            <asp:TextBox ID="txt" AutoPostBack="true" 
            runat="server"></asp:TextBox>
        </ASPP:PopupWindow>
        <ASPP:PopupWindow ID="PopupWindow2" runat="server">
            <div align="center" style="width: 500px; height: 300px">
                <asp:Label ID="Label1" runat="server">nnnnn</asp:Label>
                <br />
                <asp:TextBox ID="TextBox1" AutoPostBack="true" 
                runat="server"></asp:TextBox>
                <asp:Button ID="in" runat="server" Text="sss" />
                <asp:TextBox ID="TextBox2" AutoPostBack="true" 
                runat="server"></asp:TextBox>
            </div>
        </ASPP:PopupWindow>
    </PopupWindow>
</ASPP:PopupPanel>

On code behind

For showing purposes, use:

protected void Button1_Click(object sender, EventArgs e)
{
    pup.ShowPopupWindow();
}

For hiding purposes, use:

protected void Button2_Click(object sender, EventArgs e)
{
    pup.HidePopupWindow();
}

Events

After closing, window click event is generated if you assign to OnCloseWindowClick in popup control:

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author


You may also be interested in...

Pro
Pro

Comments and Discussions

 
QuestionDLL Pin
Kelrock31422-Nov-16 10:41
memberKelrock31422-Nov-16 10:41 
QuestionSpot on Pin
TonyOrchard28-Oct-16 3:25
memberTonyOrchard28-Oct-16 3:25 
QuestionMessage Removed Pin
DXero18-Sep-16 18:30
memberDXero18-Sep-16 18:30 
QuestionDLL Pin
Member 1263528119-Jul-16 5:15
memberMember 1263528119-Jul-16 5:15 
QuestionDLL Pin
Member 1246980219-Apr-16 0:24
memberMember 1246980219-Apr-16 0:24 
QuestionDLL Pin
tdt2326-Feb-16 4:35
membertdt2326-Feb-16 4:35 
QuestionNeed the full version Pin
Member 1201870215-Oct-15 2:26
memberMember 1201870215-Oct-15 2:26 
QuestionPlease send me full dll Pin
reljabg3-Oct-15 3:24
memberreljabg3-Oct-15 3:24 
QuestionDLL without the 100 click restriction Pin
sviluppo29-Sep-15 22:26
membersviluppo29-Sep-15 22:26 
Questionfull DLL Pin
aris_ah13-Sep-15 10:47
memberaris_ah13-Sep-15 10:47 
QuestionFull DLL Pin
heihei200111-Sep-15 1:32
memberheihei200111-Sep-15 1:32 
QuestionPlease send me full dll Pin
ov.lovyannikov8-Sep-15 22:06
memberov.lovyannikov8-Sep-15 22:06 
QuestionMycloseWindow ??? Pin
Shrikesh_kale12-Aug-15 0:34
memberShrikesh_kale12-Aug-15 0:34 
QuestionDLL Pin
Member 1046349128-Jul-15 0:57
memberMember 1046349128-Jul-15 0:57 
QuestionPlease! could you send me the full dll?? Pin
Member 1183507213-Jul-15 19:28
memberMember 1183507213-Jul-15 19:28 
QuestionBad Content Pin
Member 1166801813-Jul-15 18:18
memberMember 1166801813-Jul-15 18:18 
QuestionMessage Removed Pin
harpreet.singh677122-Jun-15 22:59
memberharpreet.singh677122-Jun-15 22:59 
QuestionPlease send DLL Pin
RudySteinhoff16-Jun-15 7:15
memberRudySteinhoff16-Jun-15 7:15 
Questiondll Pin
Member 113959437-Jun-15 5:10
memberMember 113959437-Jun-15 5:10 
Questionfull DLL Pin
Member 1094028431-May-15 21:39
memberMember 1094028431-May-15 21:39 
QuestionCould you send me the full dll ? Pin
Member 1160363910-May-15 1:53
memberMember 1160363910-May-15 1:53 
QuestionWant dll as page is showing expired.... PLz PLz Pin
Member 1145606028-Apr-15 8:36
memberMember 1145606028-Apr-15 8:36 
AnswerRe: Want dll as page is showing expired.... PLz PLz Pin
Sascha Lefévre28-Apr-15 9:13
memberSascha Lefévre28-Apr-15 9:13 
GeneralMy vote of 1 Pin
AKeck28-Apr-15 5:03
memberAKeck28-Apr-15 5:03 
QuestionPlease send the full code else please send me the Dll file . Pin
Member 115937429-Apr-15 3:53
memberMember 115937429-Apr-15 3:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.161128.1 | Last Updated 25 Oct 2013
Article Copyright 2013 by Nikhil Awatade
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid