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

 
Questioncan send me the dll Pinmemberjojoba202-Oct-14 22:50 
QuestionPlease send me the full DLL Pinmemberanil sojitra17-Sep-14 0:10 
Questionbrowser compatibility Pinmemberthiyajan14-Sep-14 23:26 
GeneralCan you send me dll code or unlimited dll PinmemberPrasadbaggam2-Sep-14 23:37 
GeneralRe: Can you send me dll code or unlimited dll Pinmemberanil sojitra17-Sep-14 0:04 
QuestionFull dll code/dll PinmemberMember 1104992031-Aug-14 23:05 
AnswerRe: Full dll code/dll Pinmemberanil sojitra17-Sep-14 0:05 
GeneralMy vote of 1 PinmemberMember 1087813328-Aug-14 9:19 
QuestionHow to get code for DLL PinmemberMember 1087813328-Aug-14 9:01 
QuestionNice Control Can you sen DLL Pinmembergnomathibus19-Aug-14 1:01 
AnswerRe: Nice Control Can you sen DLL PinmemberMember 936965120-Aug-14 6:01 
Generalsuperb PinmemberMember 1097739728-Jul-14 20:03 
Questionproblem occur in popup PinmemberSuraj Shresth24-Jul-14 21:52 
Questioncomplete,unlimited dll Pinmembertereena21-Jul-14 20:58 
QuestionIt is work for me PinmemberAnu.v19-Jul-14 2:02 
Questiondll unlimited PinmemberMember 1094255412-Jul-14 22:15 
QuestionHas anyone ever gotten this from this guy? PinmemberSeanEckenrod5-Jun-14 6:20 
AnswerRe: Has anyone ever gotten this from this guy? PinmemberMember 108746938-Jul-14 1:06 
QuestionExpired !! PinmemberMember 108652884-Jun-14 21:26 
AnswerRe: Expired !! PinmemberMember 108746938-Jul-14 1:09 
GeneralRe: Expired !! Pinmemberppfepf18-Sep-14 0:36 
QuestionNeed DLL Please PinmemberMember 93271632-Jun-14 13:29 
QuestionDLL Question [modified] PinmemberSeanEckenrod22-May-14 5:06 
QuestionNEED DLL PinmemberMember 107928153-May-14 15:39 
QuestionDLL full PinmemberMember 974365128-Apr-14 22:24 

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 | Mobile
Web02 | 2.8.141022.2 | Last Updated 25 Oct 2013
Article Copyright 2013 by Nikhil Awatade
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid