ARTICLE

Animated pop-ups using the ASP.NET AJAX framework

Posted by Purushottam Rathore Articles | ASP.NET using VB.NET January 14, 2009
In this article i am going to show how to create animated pop-ups in your ASP.NET application using the ASP.NET AJAX framework and the ASP.NET AJAX Control toolkit.
Download Files:
 
Reader Level:

In this article i am going to show how to create pop-ups in your ASP.NET application using the ASP.NET AJAX framework and the ASP.NET AJAX Control toolkit.

Ajax control tool kit provide AnimationExtender control for animation. here i am using AnimationExtender control for open and close animation like as follows:

<cc1:AnimationExtender ID="OpenAnimation" runat="server" TargetControlID="imgHelp">
    <Animations>
    </Animations>
</
cc1:AnimationExtender>
<cc1:AnimationExtender ID="CloseAnimation" runat="server" TargetControlID="btnClose">
    <Animations>
    </Animations>
</
cc1:AnimationExtender>

Example: In this example I am using a usercontrol named 'PopUp.ascx' as follows:

<%@ Control Language="vb" AutoEventWireup="true" CodeFile="Popup.ascx.vb" Inherits="Controls_Popup" %>
<%
@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<table cellpadding="0" cellspacing="0">
    <tr>
        <td>
            <img alt="Click here." id="imgHelp" runat="server" src="../Img_Star.gif" />
            <div id="flyout" class="wireFrame" style="height: <%=Height%>px"  runat="server"></div>
        </td>

        <td>
            <div id="info" style="width: <%=Width%>px;" class="InfoContainer" runat="server">
               
<div id="btnCloseParent" class="CloseParent" runat="server">
                   
<asp:LinkButton ID="btnClose" runat="server" OnClientClick="return false;" Text="X" ToolTip="Close" CssClass="CloseIcon" />
                </div> <%=DisplayText%>
            </div>
       
</td>
   
</tr>
</
table>

<cc1:AnimationExtender ID="OpenAnimation" runat="server" TargetControlID="imgHelp">
    <Animations>
    </Animations>
</
cc1:AnimationExtender>
<cc1:AnimationExtender ID="CloseAnimation" runat="server" TargetControlID="btnClose">
    <Animations>
    </Animations>
</
cc1:AnimationExtender>

Output:

when you click on image the animated pop up raise some thing like this.



How will the user open and close the Popup?

There are two common approaches to opening the popup:

  • Click a button or an object related to the Popup content.
  • Hover over something for a while. Because this can happen quite often, it's more appropriate for a small, tooltip-style, Popup.

There are a few approaches to closing the Popup:

  • Explicitly close it with a button. Some Popups appear as desktop-like Popups, with an "X" on the top border of the window.
  • If the popup was initiated with a hover event, close it when the cursor hovers away from the underlying object.
  • Close it upon a timeout.

Problems With Pop-Ups:

The common faults with pop-up windows are:

  1. If scripting is disabled, or if the browser does not support JavaScript, the pop-up will not work.
  2. Search engines cannot follow links to pop-up windows, scripted elements are always ignored).
  3. Pop-ups present accessibility problems.
  4. Site management tools (e.g. DreamWeaver) cannot update links to pop-ups if you move the destination page to another section of your site.
  5. Many people have pop-up killers running that close the window the moment it’s opened
  6. In Mozilla, there is an option to stop pop-ups opening in the first place.

Note: download  the uploaded file from this article and learn more about it.

Login to add your contents and source code to this article
share this article :
post comment
 
Team Foundation Server Hosting
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
Nevron Diagram
Become a Sponsor