Click here to Skip to main content
11,565,382 members (39,778 online)
Click here to Skip to main content

Popup Control for ASP.NET

, 25 Oct 2013 CPOL 89K 7K 19
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

Nikhil Awatade
Software Developer (Senior)
United States United States
No Biography provided

You may also be interested in...

Comments and Discussions

 
QuestionMessage Removed Pin
harpreet.singh677122-Jun-15 21:59
memberharpreet.singh677122-Jun-15 21:59 
QuestionPlease send DLL Pin
RudySteinhoff16-Jun-15 6:15
memberRudySteinhoff16-Jun-15 6:15 
Questiondll Pin
Member 113959437-Jun-15 4:10
memberMember 113959437-Jun-15 4:10 
Questionfull DLL Pin
Member 1094028431-May-15 20:39
memberMember 1094028431-May-15 20:39 
QuestionCould you send me the full dll ? Pin
Member 1160363910-May-15 0:53
memberMember 1160363910-May-15 0:53 
QuestionWant dll as page is showing expired.... PLz PLz Pin
Member 1145606028-Apr-15 7:36
memberMember 1145606028-Apr-15 7:36 
AnswerRe: Want dll as page is showing expired.... PLz PLz Pin
Sascha Lefévre28-Apr-15 8:13
memberSascha Lefévre28-Apr-15 8:13 
GeneralMy vote of 1 Pin
AKeck28-Apr-15 4:03
memberAKeck28-Apr-15 4:03 
QuestionPlease send the full code else please send me the Dll file . Pin
Member 115937429-Apr-15 2:53
memberMember 115937429-Apr-15 2:53 
QuestionFull DLL Pin
pbshines7-Apr-15 2:33
memberpbshines7-Apr-15 2:33 
Questionfull DLL Pin
Jean Obed7-Apr-15 0:05
memberJean Obed7-Apr-15 0:05 
QuestionHave to click button twice to fire Pin
4Dinand223-Mar-15 8:37
professional4Dinand223-Mar-15 8:37 
QuestionMicrosoft JScript runtime error: 'tzdragg' is undefined Pin
Member 1085666319-Mar-15 22:26
memberMember 1085666319-Mar-15 22:26 
AnswerRe: Microsoft JScript runtime error: 'tzdragg' is undefined Pin
StephLemay3328-Apr-15 7:43
memberStephLemay3328-Apr-15 7:43 
QuestionFull DLL Pin
Jing Go Bell24-Feb-15 4:12
memberJing Go Bell24-Feb-15 4:12 
QuestionFull DLL Pin
Member 1092373613-Feb-15 0:23
memberMember 1092373613-Feb-15 0:23 
QuestionPopupPanel1An unhandled exception has occurred. Object reference not set to an instance of an object. Pin
Member 1074388811-Feb-15 0:59
memberMember 1074388811-Feb-15 0:59 
GeneralMy vote of 1 Pin
Member 1047279112-Jan-15 9:30
professionalMember 1047279112-Jan-15 9:30 
QuestionFull dll Pin
Christian Inostroza6-Jan-15 6:57
memberChristian Inostroza6-Jan-15 6:57 
Questiondll fail Pin
Member 105026324-Jan-15 9:14
memberMember 105026324-Jan-15 9:14 
AnswerDLL is attached to the article Pin
saquib79212-Jan-15 12:06
membersaquib79212-Jan-15 12:06 
QuestionDLL Pin
Member 112969368-Dec-14 22:22
memberMember 112969368-Dec-14 22:22 
QuestionDll Expired Pin
Ultraviolet896-Dec-14 23:11
memberUltraviolet896-Dec-14 23:11 
QuestionDll Expired Pin
Member 1120460624-Nov-14 2:06
memberMember 1120460624-Nov-14 2:06 
GeneralMy vote of 1 Pin
lllyxer5-Nov-14 6:19
memberlllyxer5-Nov-14 6:19 
Questioncan send me the dll Pin
jojoba202-Oct-14 22:50
memberjojoba202-Oct-14 22:50 
QuestionPlease send me the full DLL Pin
anil sojitra17-Sep-14 0:10
memberanil sojitra17-Sep-14 0:10 
Questionbrowser compatibility Pin
thiyajan14-Sep-14 23:26
memberthiyajan14-Sep-14 23:26 
GeneralCan you send me dll code or unlimited dll Pin
Prasadbaggam2-Sep-14 23:37
memberPrasadbaggam2-Sep-14 23:37 
GeneralRe: Can you send me dll code or unlimited dll Pin
anil sojitra17-Sep-14 0:04
memberanil sojitra17-Sep-14 0:04 
GeneralRe: Can you send me dll code or unlimited dll Pin
Member 1145606028-Apr-15 7:33
memberMember 1145606028-Apr-15 7:33 
QuestionFull dll code/dll Pin
Member 1104992031-Aug-14 23:05
memberMember 1104992031-Aug-14 23:05 
AnswerRe: Full dll code/dll Pin
anil sojitra17-Sep-14 0:05
memberanil sojitra17-Sep-14 0:05 
GeneralMy vote of 1 Pin
Member 1087813328-Aug-14 9:19
memberMember 1087813328-Aug-14 9:19 
QuestionHow to get code for DLL Pin
Member 1087813328-Aug-14 9:01
memberMember 1087813328-Aug-14 9:01 
QuestionNice Control Can you sen DLL Pin
gnomathibus19-Aug-14 1:01
membergnomathibus19-Aug-14 1:01 
AnswerRe: Nice Control Can you sen DLL Pin
Member 936965120-Aug-14 6:01
memberMember 936965120-Aug-14 6:01 
Generalsuperb Pin
Member 1097739728-Jul-14 20:03
memberMember 1097739728-Jul-14 20:03 
Questionproblem occur in popup Pin
Suraj Shresth24-Jul-14 21:52
memberSuraj Shresth24-Jul-14 21:52 
Questioncomplete,unlimited dll Pin
tereena21-Jul-14 20:58
membertereena21-Jul-14 20:58 
QuestionIt is work for me Pin
Anu.v19-Jul-14 2:02
memberAnu.v19-Jul-14 2:02 
Questiondll unlimited Pin
Member 1094255412-Jul-14 22:15
memberMember 1094255412-Jul-14 22:15 
QuestionHas anyone ever gotten this from this guy? Pin
SeanEckenrod5-Jun-14 6:20
memberSeanEckenrod5-Jun-14 6:20 
AnswerRe: Has anyone ever gotten this from this guy? Pin
Member 108746938-Jul-14 1:06
memberMember 108746938-Jul-14 1:06 
QuestionExpired !! Pin
Member 108652884-Jun-14 21:26
memberMember 108652884-Jun-14 21:26 
AnswerRe: Expired !! Pin
Member 108746938-Jul-14 1:09
memberMember 108746938-Jul-14 1:09 
GeneralRe: Expired !! Pin
ppfepf18-Sep-14 0:36
memberppfepf18-Sep-14 0:36 
QuestionNeed DLL Please Pin
Member 93271632-Jun-14 13:29
memberMember 93271632-Jun-14 13:29 
QuestionDLL Question Pin
SeanEckenrod22-May-14 5:06
memberSeanEckenrod22-May-14 5:06 
QuestionNEED DLL Pin
Member 107928153-May-14 15:39
memberMember 107928153-May-14 15:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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
Web03 | 2.8.150624.2 | Last Updated 25 Oct 2013
Article Copyright 2013 by Nikhil Awatade
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid