Click here to Skip to main content
Click here to Skip to main content

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

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

Comments and Discussions

 
GeneralMy vote of 1 Pinmemberlllyxer5-Nov-14 7:19 
Questioncan send me the dll Pinmemberjojoba202-Oct-14 23:50 
QuestionPlease send me the full DLL Pinmemberanil sojitra17-Sep-14 1:10 
Questionbrowser compatibility Pinmemberthiyajan15-Sep-14 0:26 
GeneralCan you send me dll code or unlimited dll PinmemberPrasadbaggam3-Sep-14 0:37 
GeneralRe: Can you send me dll code or unlimited dll Pinmemberanil sojitra17-Sep-14 1:04 
QuestionFull dll code/dll PinmemberMember 110499201-Sep-14 0:05 
AnswerRe: Full dll code/dll Pinmemberanil sojitra17-Sep-14 1:05 
GeneralMy vote of 1 PinmemberMember 1087813328-Aug-14 10:19 
QuestionHow to get code for DLL PinmemberMember 1087813328-Aug-14 10:01 
QuestionNice Control Can you sen DLL Pinmembergnomathibus19-Aug-14 2:01 
AnswerRe: Nice Control Can you sen DLL PinmemberMember 936965120-Aug-14 7:01 
Generalsuperb PinmemberMember 1097739728-Jul-14 21:03 
Questionproblem occur in popup PinmemberSuraj Shresth24-Jul-14 22:52 
Questioncomplete,unlimited dll Pinmembertereena21-Jul-14 21:58 
QuestionIt is work for me PinmemberAnu.v19-Jul-14 3:02 
Questiondll unlimited PinmemberMember 1094255412-Jul-14 23:15 
QuestionHas anyone ever gotten this from this guy? PinmemberSeanEckenrod5-Jun-14 7:20 
AnswerRe: Has anyone ever gotten this from this guy? PinmemberMember 108746938-Jul-14 2:06 
QuestionExpired !! PinmemberMember 108652884-Jun-14 22:26 
AnswerRe: Expired !! PinmemberMember 108746938-Jul-14 2:09 
GeneralRe: Expired !! Pinmemberppfepf18-Sep-14 1:36 
QuestionNeed DLL Please PinmemberMember 93271632-Jun-14 14:29 
QuestionDLL Question [modified] PinmemberSeanEckenrod22-May-14 6:06 
QuestionNEED DLL PinmemberMember 107928153-May-14 16:39 
QuestionDLL full PinmemberMember 974365128-Apr-14 23:24 
QuestionNeed to change the Header color PinmemberNuthan Gowda24-Apr-14 3:03 
Questiondll needed urgently Pinmemberdeepak23089015-Apr-14 19:03 
QuestionNeed dll Pinmembersree_jisha9-Apr-14 18:15 
QuestionExpired Pinmemberkreattor20-Mar-14 9:14 
Questionresolved :) PinmemberJasRaj Bishnoi10-Mar-14 21:44 
QuestionExpired PinmemberMember 1065741410-Mar-14 0:51 
QuestionNeed DLL PinmemberMember 106138666-Mar-14 21:14 
QuestionNeed DLL PinmemberJasRaj Bishnoi4-Mar-14 22:33 
AnswerRe: Need DLL PinmemberNevs086-Mar-14 20:44 
QuestionRequest Full DLL PinmemberMember 1054130322-Feb-14 22:58 
QuestionHow to get the text box ..text in cs page ex: Textbox1.text Pinmemberrajmohan131112-Feb-14 1:53 
QuestionNeed full dll Pinmemberrajmohan131112-Feb-14 1:02 
Question't Pinmembermano444-Feb-14 7:58 
QuestionNeed complete DLL Pinmembernijakanthan30-Jan-14 9:35 
QuestionDLL without the 100 clicks restriction PinmemberMember 1001269030-Jan-14 5:06 
Questioncomplete dll Pinmemberthabang0224-Jan-14 4:14 
QuestionHow to style the generated popup ? PinmemberRilcy7523-Jan-14 2:09 
Questioncan i change c the color of the header text or change the close icon? Pinmemberhoggydos21-Jan-14 21:56 
QuestionI need your dll Pinmembertannguyen0321-Jan-14 21:20 
QuestionWhere from i will find ASP.Web.UI.PopupControl PinmemberMERAZ_UDDIN8-Jan-14 0:53 
Questioncomplete dll for popup PinmemberMember 1043021327-Nov-13 8:36 
GeneralMy vote of 5 PinmemberMember 103518147-Nov-13 1:58 
QuestionThank you for this it saves a lot of work. PinmemberMember 103518147-Nov-13 1:54 
QuestionWhy does the control expire after 100 clicks? PinmemberMember 790852930-Oct-13 10:45 

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
Web04 | 2.8.1411019.1 | Last Updated 25 Oct 2013
Article Copyright 2013 by Nikhil Awatade
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid