5,136,034 members and growing! (12,416 online)
Email Password   helpLost your password?
Web Development » Ajax and Atlas » Samples     Intermediate License: The Code Project Open License (CPOL)

Login/SignUp Screen Using Ajax ModalPopup Extender

By Pramod S Kumar

How to Implement Login/Signup Screen Using Ajax ModalPopup Extender
C# (C# 1.0, C# 2.0, C# 3.0, C#), CSS, HTML, .NET (.NET, .NET 2.0), Visual Studio (VS2005, VS), ASP.NET, Ajax

Posted: 3 Apr 2008
Updated: 3 Apr 2008
Views: 8,038
Announcements



Search    
Advanced Search
Sitemap
9 votes for this Article.
Popularity: 3.34 Rating: 3.50 out of 5
0 votes, 0.0%
1
2 votes, 33.3%
2
0 votes, 0.0%
3
1 vote, 16.7%
4
3 votes, 50.0%
5
Note: This is an unedited contribution. If this article is inappropriate, needs attention or copies someone else's work without reference then please Report This Article

LoginModalPopup

SignupScreen.JPG

Introduction

I want to take this opportunity to introduce a sample application which shows how to use ModalPopupExtender for Logging and Signup for any ASP.NET web application. In this quick demonstration, I am going to show you how we can implement Modal Dialog Box using AJAX in ASP.NET. Modal Dialog Box (Formally called ModalPopupExtender) is extremely essential in today’s application as it avoids redirecting to a new page just to login or signup the users. A simple example can show how to implement the same.

Background

I was just looking around to use modalpopupextender for login & signup for my site...but I could not find one. So finally ended up creating this login sample application so it might be useful for everyone.

Using the Code

To start with lets understand about Modalpopup...

ModalPopup Description

The ModalPopup extender allows a page to display content to the user in a "modal" manner which prevents the user from interacting with the rest of the page. The modal content can be any hierarchy of controls and is displayed above a background that can have a custom style applied to it. When displayed, only the modal content can be interacted with; clicking on the rest of the page does nothing. When the user is done interacting with the modal content, a click of an OK/Cancel control dismisses the modal content and optionally runs custom script.

ModalPopup Properties:

The control above is initialized with this code. The display on the modal popup element is set to none to avoid a flicker on render. The italic properties are optional:

<ajaxToolkit:ModalPopupExtender ID="MPE" runat="server"
    TargetControlID="LinkButton1"
    PopupControlID="Panel1"
    BackgroundCssClass="modalBackground" 
    DropShadow="true" 
    OkControlID="OkButton" 
    OnOkScript="onOk()"
    CancelControlID="CancelButton" 
    PopupDragHandleControlID="Panel3" />
  • TargetControlID - The ID of the element that activates the modal popup
  • PopupControlID - The ID of the element to display as a modal popup
  • BackgroundCssClass - The CSS class to apply to the background when the modal popup is displayed
  • DropShadow - True to automatically add a drop-shadow to the modal popup
  • OkControlID - The ID of the element that dismisses the modal popup
  • OnOkScript - Script to run when the modal popup is dismissed with the OkControlID
  • CancelControlID - The ID of the element that cancels the modal popup
  • OnCancelScript - Script to run when the modal popup is dismissed with the CancelControlID
  • PopupDragHandleControlID - The ID of the embedded element that contains the popup header/title which will be used as a drag handle
  • X - The X coordinate of the top/left corner of the modal popup (the popup will be centered horizontally if not specified)
  • Y - The Y coordinate of the top/left corner of the modal popup (the popup will be centered vertically if not specified)
  • RepositionMode - The setting that determines if the popup needs to be repositioned when the window is resized or scrolled.

This shows how you define modalpopup extender for login and signup screen buttons...

<modalpopupextender id="ModalPopupExtenderLogin" runat="server" targetcontrolid="Loginlnk" popupcontrolid="LoginPanel" backgroundcssclass="modalBackground" dropshadow="true" okcontrolid="LoginBtn" önokscript="ok()" cancelcontrolid="CancelBtn" /><modalpopupextender id="ModalPopupExtenderSignup" runat="server" targetcontrolid="Signuplnk" popupcontrolid="SignupPanel" backgroundcssclass="modalBackground" dropshadow="true" okcontrolid="JoinBtn" önokscript="okJoin()" cancelcontrolid="CancelBtn2" />

Installation:

Download Ajax toolkit Version 1.0.20229 from this link...
http://www.codeplex.com/AtlasControlToolkit/Release/ProjectReleases.aspx?ReleaseId=11121

Also you need ASP.NET AJAX Extensions 1.0 for ASP.NET 2.0...you can get this from this link...
http://www.asp.net/ajax/downloads/

Once you have all those....open the sample project in VS2005 and it should work.

History

April 3rd 2008. Initial version published

License

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

About the Author

Pramod S Kumar


Pramod has been a software developer for more than 6 years now mostly working on Ajax ASP.NET web applications.
Occupation: Software Developer (Senior)
Company: NYCEDC
Location: United States United States

Other popular Ajax and Atlas articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 3 of 3 (Total in Forum: 3) (Refresh)FirstPrevNext
Subject  Author Date 
GeneralGreatmembervvvlad6:49 6 Apr '08  
Generalcan login/signup be ssl secure, while main page is not?memberThanks for all the fish5:14 4 Apr '08  
GeneralRe: can login/signup be ssl secure, while main page is not?memberThanks for all the fish12:02 6 May '08  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 3 Apr 2008
Editor:
Copyright 2008 by Pramod S Kumar
Everything else Copyright © CodeProject, 1999-2008
Web13 | Advertise on the Code Project