Using the UpdateProgress control as a modal overlay - Raj Kaimal

Using the UpdateProgress control as a modal overlay

After reading up on the Extender Control tutorial, I decided to write my first Extender control as a learning exercise. 
UpdateProgressOverlayExtender is an ASP.Net AJAX extender that can be attached to any UpdateProgress control in order to position it over any control that you specify. If a control is not specified, the UpdateProgress control is positioned over its AssociatedUpdatePanel. You can even position it over the Form control or the document display area to give a modal effect. The screen capture below shows the UpdateProgress control overlaying a GridView control.

UpdProgOverlayExtender

To run the sample, compile your solution before running the website.

Download code
 (look under Flan AJAX Controls )
Mirror

Please let me know what you think!

PS: If you wish to display a modal dialog using AJAX, use the Modal Popup in the AJAX control toolkit.

Published Monday, January 08, 2007 11:55 PM by rajbk
Filed under: ,

Comments

# re: Using the UpdateProgress control as a modal overlay

Raj

Could you send me a little info on controlling where the graphic or whatever appears - I seem to be too stupid to figure out what CSS I need to add to center it etc.

Thanks

Tuesday, January 23, 2007 1:00 AM by Dylan Barber

# re: Using the UpdateProgress control as a modal overlay

Look at the ".updateProgress" and ".updateProgress div" classes in the CSS file. These get applied to the asp:UpdateProgress control and its inner div (see arrow below):

   <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1"

       DisplayAfter="0">

       <ProgressTemplate>

           <div> <=====

               <img src="../Resources/Images/indicator.gif" />

               Loading...

           </div>

       </ProgressTemplate>

   </asp:UpdateProgress>

Tuesday, January 23, 2007 1:15 AM by rajbk

# re: Using the UpdateProgress control as a modal overlay

Any idea how to make this work when the UpdateProgress/UpdatePanel is inside an AJAXControlToolkit ModalPopupExtender already?  I think the issue is "when" the javascript calculates the position for the modal overlay.  It needs to do it *after* the MPE has positioned it (possible?)

Wednesday, February 14, 2007 10:05 AM by Brett

# re: Using the UpdateProgress control as a modal overlay

Raj, this is great! I cannot get it to work however. I keep getting an Iframe javascript error. I'll keep playing with it, but keep it up. Great idea.

Wednesday, February 14, 2007 6:39 PM by Jack

# re: Using the UpdateProgress control as a modal overlay

what a great control, i was looking around for such somthing, and u made my day

thanks alot

Mohamed Faramawi, Cairo,Egypt

Thursday, February 15, 2007 4:41 AM by Mohmaed Faramawi

# re: Using the UpdateProgress control as a modal overlay

Thanks very much for fixing the relative / absolute positioning issues in the latest release.

This is now an AWESOME control! Well done for a really great piece of work.

Sunday, February 18, 2007 1:37 PM by Holf

# re: Using the UpdateProgress control as a modal overlay

Okay is there a way to make the control cover a whole page not just the update panel ?

Tuesday, April 10, 2007 10:18 AM by Dylan Barber

# re: Using the UpdateProgress control as a modal overlay

Dylan,

The examples shows you how to cover the whole page. Set OverlayType to Browser.

Tuesday, April 10, 2007 10:27 AM by rajbk

# re: Using the UpdateProgress control as a modal overlay

This code is exactly what I am trying to do, but it does not seem to be working for me.  Could you look at how I have implemented the code and comment on what I am doing wrong?

Thanks

<%@ Page Language="C#" MasterPageFile="~/P/P.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="P_Find_Default" Title="Untitled Page" %>

<%@ Register Assembly="Flan.Controls" Namespace="Flan.Controls" TagPrefix="cc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainHolder" Runat="Server">

 <asp:ScriptManager id="ScriptManager1" runat="server"></asp:ScriptManager>

 <div style='border:1px #000000 solid;width:970px;height:180px; padding-left:4px; padding-top:4px;'>

   <div style='float:left;width:200px;'>

      State:   <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" DataSourceID="StateSource" DataTextField="states_abbreviation" DataValueField="states_abbreviation" OnSelectedIndexChanged="UpdatePlanPanel"></asp:DropDownList>

         <asp:SqlDataSource ID="StateSource" runat="server" ConnectionString="<%$ ConnectionStrings:V4ConnectionString %>" SelectCommand="select distinct states_abbreviation from commorg a, commorgaddress b,states s where a.commorg_id=b.commorg_id and b.states_id*=s.states_id order by states_abbreviation"></asp:SqlDataSource>

    <br /> Sqft Low :

     <asp:ListBox ID="ListBox1" runat="server" AutoPostBack="true" OnSelectedIndexChanged="UpdatePlanPanel">

       <asp:ListItem Selected="True" Value="-1">Select Low</asp:ListItem>

     </asp:ListBox><br />

     Sqft High :<asp:ListBox ID="ListBox2" runat="server" AutoPostBack="true" OnSelectedIndexChanged="UpdatePlanPanel">

       <asp:ListItem Selected="True" Value="-1">Select High</asp:ListItem>

     </asp:ListBox></div>

   <div>

     <asp:UpdatePanel id="UpdatePanel2" UpdateMode="Conditional" runat="server">

       <contenttemplate>

         <asp:TextBox id="TextBox1" runat="server" width="50px"></asp:TextBox> Homes Found

         <asp:DataList id="DataList1" runat="server"  ForeColor="Black" CellPadding="2" BackColor="LightGoldenrodYellow" BorderColor="Tan" BorderWidth="1px" RepeatColumns="3" ShowFooter="False" ShowHeader="False" RepeatDirection="Horizontal" RepeatLayout="Table">

           <FooterStyle BackColor="Tan"></FooterStyle>

           <SelectedItemStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite"></SelectedItemStyle>

           <ItemTemplate>

             <asp:Image runat="server" ImageUrl='<%# Eval("image_file")%>'></asp:Image><br />

             <asp:Label id="PLAN_NameLabel" runat="server" Text='<%# Eval("PLAN_Name") %>'></asp:Label><BR /><BR />

           </ItemTemplate>

           <AlternatingItemStyle BackColor="PaleGoldenrod"></AlternatingItemStyle>

           <HeaderStyle BackColor="Tan" Font-Bold="True"></HeaderStyle>

         </asp:DataList>

        </contenttemplate>

       <Triggers>

         <asp:AsyncPostBackTrigger ControlID="DropDownList1" EventName="SelectedIndexChanged"></asp:AsyncPostBackTrigger>

         <asp:AsyncPostBackTrigger ControlID="ListBox1" EventName="SelectedIndexChanged"></asp:AsyncPostBackTrigger>

         <asp:AsyncPostBackTrigger ControlID="ListBox2" EventName="SelectedIndexChanged"></asp:AsyncPostBackTrigger>

       </Triggers>

     </asp:UpdatePanel>

   </div>

 </div>

   <asp:UpdateProgress ID="upUpdateProgress" AssociatedUpdatePanelID="UpdatePanel2" runat="server" DisplayAfter=0>

       <ProgressTemplate>

           <div>

                <img src="../../../assets/images/indicator.gif" />

               Loading in 4 seconds...

           </div>

       </ProgressTemplate>

     </asp:UpdateProgress>

     <cc1:UpdateProgressOverlayExtender ID="UpdateProgressOverlayExtender1" runat="server" ControlToOverlayID="DataList1" CssClass="updateProgress" TargetControlID="upUpdateProgress" />

 </asp:Content>

Thursday, April 12, 2007 2:11 PM by Apurva Muddappa

# re: Using the UpdateProgress control as a modal overlay

Hey Raj !!!

good control !

gr8 work dude keep it up....

Best Wishes,

Shekhar

Tuesday, April 17, 2007 2:32 AM by shekhar

# re: Using the UpdateProgress control as a modal overlay

Hii Raj !

I have used overlay control with gridview...

but on sorting of grid it throws javascript exception that "className is null or not an object "..

this error disappears when i removed overlay extender control....

could you please help me with this ?

Thanks n regards,

Shekhar

Tuesday, April 17, 2007 2:54 AM by shekhar

# Minor Gripe?

First off, awesome job so far.  This control is easy to use and nice and customizable.

However, my page does not extend far enough down to take the entire window, so when I call OverlayType="Browser", the UpdateProgress that appears only comes down as far as the content.  

Any way to fix this?  

-Z

Monday, April 23, 2007 1:19 PM by Zak

# re: Using the UpdateProgress control as a modal overlay

Hi Raj

You have done an awesome job... great work indeed.... but am facing one issue with the dropdown... i.e. dropdown gets disappear when we click one any button. Dropdown seems to be working fine on firefox... It’s giving this trouble on IE. I would really appreciate if you could answer this ASAP

Wednesday, May 02, 2007 9:22 AM by Harish

# re: Using the UpdateProgress control as a modal overlay

Hi Raj,

This is an excellent set of controls you have released! Very powerful, yet simple and easy-to-use. But is there any way of positioning the Gif and loading text within the ProgressTemplate such that it is always absolutely centered, whether the OverlayType is set to browser or control?

regards

Monday, June 04, 2007 6:57 AM by shalan99

# re: Using the UpdateProgress control as a modal overlay

SWEET! Exactly what I was looking for.  I plan on playing with it today.

Thursday, June 14, 2007 12:21 PM by Kevin Jensen

# re: Using the UpdateProgress control as a modal overlay

This is a great control. However, I am running into a problem with the Gif animation. The animation stops, then waits about 1-3 seconds when coming back to the page. Any thoughts on how to troubleshoot this.

Thursday, August 16, 2007 10:34 AM by Michael Rivera

# re: Using the UpdateProgress control as a modal overlay

Michael,

Assuming you are using a gif animation with an infinite loop, the only time I have seen it stop is when the browser is doing some processing to update the UI.

Raj

Thursday, August 16, 2007 10:46 AM by rajbk

# re: Using the UpdateProgress control as a modal overlay

Hi Raj,

You have done a great job. I need a little help from you.

I would like to display the animation gif in the center of the object(grid/window/panel).

Thanks in advance

Arabinda

Monday, August 20, 2007 9:30 PM by Arabinda

# re: Using the UpdateProgress control as a modal overlay

can it be done with out using

System.Threading.Thread.Sleep(4000); ?

i dont know for the fact that how much time my server will take to get data from server and it may be more then 4 sec or 40 sec

is there a way can be done without using

System.Threading.Thread.Sleep(4000); ?

thanks.

Tuesday, August 21, 2007 9:30 PM by Nisar Khan

# re: Using the UpdateProgress control as a modal overlay

Nisar,

As I have mentioned in the default page of the samples, the Sleep statement is used to introduce a delay which helps in seeing the update progress animation. You *should not* use it in production.

Wednesday, August 22, 2007 9:31 AM by rajbk

# re: Using the UpdateProgress control as a modal overlay

I'm getting a javascript error 'className' is null

or not an object.

On the first callback, it works 100%, but the second one I do, I get this error and the overlay doesn't display.

Thursday, August 23, 2007 10:35 AM by Sean

# re: Using the UpdateProgress control as a modal overlay

I figured out why the className error gets thrown.

On the second postback, it would seem that this.get_element() is returning undefined in the _onShow function.

Very wierd. Its definatly not undefined in the beginRequest and endRequest of the same postback.

I'm lost of how to fix this as I always thought this.get_element() as pretty reliable.

One other minor problem/bug. If the control to overlay is within a scrolling area, eg. div, and that area is scrolled down/up a bit so that the control is not fully visible, when the overlay appears, it will cover what is visible of the control and also continue over and out of the scrolling area.

Friday, August 24, 2007 7:23 AM by Sean

# re: Using the UpdateProgress control as a modal overlay

Great control, but is there a way to dynamically add an updatepanel, gridview, and your extender control? Ive tried everything I known, it always throws exceptions that it cannot find a control.

Im trying to make a composite control that will be in a class library.

Thanks!

Friday, August 31, 2007 9:33 AM by Nick

# re: Using the UpdateProgress control as a modal overlay

This control is excellent and has saved hours of development time!!!

Great Work ;)

Wednesday, September 12, 2007 7:06 AM by Gareth Clare

# re: Using the UpdateProgress control as a modal overlay

This is great work man!!

Thursday, November 29, 2007 11:50 PM by ronald widha

# re: Using the UpdateProgress control as a modal overlay

Hi Raj,

I've been using this control for many months and I'm very happy with it. However, since upgrading to .NET Framework 3.5 I get the following error every time I have an Update Panel Overlay Exteder on the page:

'The control with ID 'upoeQuestion' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it.'

I have a ScriptManager on my Master page, and

ScriptManagerProxys on all other pages where I am using MS Ajax. I have no idea why I am getting this error message.

Any thoughts on this would be much appreciated...

Sunday, December 02, 2007 5:05 PM by Holf

# re: Using the UpdateProgress control as a modal overlay

Well, I've worked out what the problem was. According to this article: www.ajaxlines.com/.../_using_older_ajax_controls_in_visual_studio_.php

you can run into problems if you use a control which was complied against the earlier (i.e.  not .NET Framework 3.5) version of the Ajax System.Web.Extensions dll.

I tried the web.config additions suggested (indeed, they were already there), but it made no difference.

So, I recompiled Raj's control, setting the target framework to be .NET Framework 3.5. I also removed the Reference to System.Web.Extensions version 1.0.61025.0 and replaced it with version 3.5.0.0.

Now everything works just fine!

Tuesday, December 04, 2007 4:30 PM by Holf

# re: Using the UpdateProgress control as a modal overlay

I've had this problem with the get_Element() method that Sean mentioned above.

Interestingly with every page refresh the onShown handler gets called an increasing number of times (once on the first page refresh, twice on the second, etc.) Does it have something to do with disposing the control?

Not too sure as I'm not that no top of these extender behaviors.....

Friday, December 14, 2007 1:56 PM by Steve

# Improving DataList pagination using AJAX controls

Improving DataList pagination using AJAX controls

Monday, January 07, 2008 6:10 AM by Blocks4.NET Team Blog

# re: Using the UpdateProgress control as a modal overlay

Sean and Steve,

I have a new version out there. Let me know if you still run into issues.

Thanks.

Raj

Sunday, January 20, 2008 1:35 AM by rajbk

# re: Using the UpdateProgress control as a modal overlay

Absolutely superb control - it saved me A LOT of digging to write my own!

Thank you

Sam

Thursday, February 07, 2008 5:42 AM by S Armondi

# re: Using the UpdateProgress control as a modal overlay

Found that if you don't have a CssClass listed, that it will throw the className errors that Sean and Steve listed. After I gave it a CSS to use, it started working every time.

Raj,

Thanks for this great AJAX control!

Thursday, February 07, 2008 6:23 AM by Jerry

# re: Using the UpdateProgress control as a modal overlay

Hi, nice control, haven't played around with it for that long yet but I've run in to an issue I can't seem to solve.

For background info: I have a master page with a UpdateProgress that I try to hook the UpdateProgressOverlayExtender to it. I'm trying to lock the whole browser.

The result is that the UpdateProgress and OverlayExtender only shows on the first postback for every page. The second time, nothing shows, it's just a normal postback. If I comment out the OverlayExtender, the UpdateProgress appears for each postback as it should.

I've tried to put the UpdateProgress and OverlayExtender in underlying pages, not the master page, but the result is the same.

Any ideas?

Tuesday, February 12, 2008 8:36 AM by Johan

# re: Using the UpdateProgress control as a modal overlay

First of all nice control, but it doesnt work with triggers. How can I make it working with AsyncPostBackTrigger

Thanks.

Wednesday, February 13, 2008 6:53 AM by saglamtimur

# re: Using the UpdateProgress control as a modal overlay

What about the licenising of this , can I use this in ma program without any problems

Monday, February 25, 2008 6:48 PM by Srikant C

# re: Using the UpdateProgress control as a modal overlay

Srikant,

The code provided is free and not copyrighted.

Monday, February 25, 2008 7:30 PM by rajbk

# re: Using the UpdateProgress control as a modal overlay

I figured out my problem with the OverlayExtender only appearing on the first postback. I had set DynamicLayout to false on my UpdateProgress (don't ask me why). Deleting that did the trick, it works as it should now. Thanks again for this nice control.. :)

Wednesday, March 05, 2008 2:19 AM by Johan

# re: Using the UpdateProgress control as a modal overlay

Mate, this is great! thanks alot!

You did a great job!

Friday, March 07, 2008 9:24 AM by homiee

# re: Using the UpdateProgress control as a modal overlay

How to create the UpdateProgressOverlayExtender by Code? Do you have some example about it?

Friday, March 07, 2008 12:23 PM by HANK

# re: Using the UpdateProgress control as a modal overlay

Extender control 'UpdateProgressOverlayExtender1' cannot extend 'GridView1'.

Extender controls of type 'Flan.Controls.UpdateProgressOverlayExtender' cannot extend controls of type 'System.Web.UI.WebControls.GridView'.

doesn't work. what do I need to do?

Wednesday, March 12, 2008 8:01 AM by gnjisa

# re: Using the UpdateProgress control as a modal overlay

where is the code for this? the link does not seem to have it.  or am i missing it? -thx.

Sunday, March 30, 2008 10:21 PM by joe

# modal animations asp net ajax

Pingback from  modal animations asp net ajax

Friday, May 30, 2008 10:45 AM by modal animations asp net ajax

# re: Using the UpdateProgress control as a modal overlay

Great Job, Raj!

Did anyone ever figure out how to make this work with Triggers?

Sunday, June 01, 2008 2:40 PM by hkh

# re: Using the UpdateProgress control as a modal overlay

By the samples and conceptually this looks fantastic!

Unfortunately, when I try to utilize it I get nothing but missing references.  Even in the sample project, when I try to run the sample website with no editing, it crashes with:

"Could not load file or assembly 'Flan.Controls' or one of its dependencies. The system cannot find the file specified."

I'm sure it's just a matter of missing references or something of the like, but I have noticed there is a conspicuous lack of installation or use instructions.  (ergo, I don't know which references to add.)  If you think you could perhaps make even a quick list of what-to-do, I think that would help tremendously.  Until then, it seems that I (for one, and I have noticed other commentors are in a similar boat) will apparently be unable to use this.

Otherwise, I'm very excited to get to work with this--it looks really cool.

Tuesday, June 10, 2008 5:53 PM by Zack

# re: Using the UpdateProgress control as a modal overlay

Zach,

You are correct. The refernces needed to be updated. In addition, there was a deprecated class that was being used. I have updated the code to fix both issues.

Please post on the issue tracker on Codeplex if you still run into issues. 

Thanks for reporting this.

Raj

Tuesday, June 10, 2008 11:35 PM by rajbk

# re: Using the UpdateProgress control as a modal overlay

Is there a way to set the showat, etc. with client-side JS rather than via a post-back?

Tuesday, June 24, 2008 12:28 PM by Travis

# re: Using the UpdateProgress control as a modal overlay

Is there any way to crank the DIV style back to 100%?  

I love everything about this, except that I'd like to get the div opacity back up to 100% so that it looks like there's a modal popup, not just floating text.   I find the text doesn't always work the greatest. I've tried copying the opacity css from the updateProgressBackground into the .div part, then increasing them to 100% (and even trying great numbers, just to be sure) and no matter what, that div is still only the same opacity as the surroundings.  Thanks.

Friday, September 19, 2008 1:48 PM by Andy

# re: Using the UpdateProgress control as a modal overlay

Andy,

From what I understand, you want to keep the child div opacity at 100% while keeping its parent element is at, say, 70%.

This, AFAIK, is not possible with the current CSS standard. The parent element opacity is applied only after all its children have been rendered.

Raj

Friday, September 19, 2008 2:06 PM by rajbk

# re: Using the UpdateProgress control as a modal overlay

Thanks for the response, Raj.

Not the answer I was hoping for, but I was afraid that it might be the reality.

Friday, September 19, 2008 2:33 PM by Andy

Leave a Comment

(required) 
(required) 
(optional)
(required)