Wednesday, March 28, 2012

UpdateProgress not showing.

I have an update panel that has 4 triggers to update it, and then I have an UpdateProgress that shows for that panel.


However the progress doesn't show unless a button in the panel is clicked, can it be made to show whenever the panel updates?


Thanks.

The UpdateProgress will not show automatically for any asyncpostback trigger. you have to manually show it. Check out this urlhttp://www.asp.net/AJAX/Documentation/Live/tutorials/ProgrammingUpdateProgress.aspx -Displaying Update Progress Using Client Script section.


Thanks! Will check into this.

Yes you have to see the online documentation

http://asp.net/ajax/documentation/live/tutorials/ProgrammingUpdateProgress.aspx

UpdateProgress not showing up

I have a page which has a FormView control and when I click one of the rows I get an ModalPopup for editing the detailed information. This works, however it takes too long for ModalPopup to open. Since I haven't found any solution for speeding up the ModalPopup, I thought I might as well inform the user that the data is loading on the background. I also thought that I might give UpdateProgress-control a try. I know that this is not the best solution for this (performance) issue but so far is the best I can figure out.

My page looks like this:

<Button> (hidden)
<ModalPopupExtender>
<Panel>
<UpdatePanel>
<FormView>
</UpdatePanel>
<UpdateProgress>
</Panel>

So what I would like is that before ModalPopup is visible, user gets an message presented by UpdateProgress, that something is going on. However with this current setup, nothing happens, UpdateProgress is not activated. Any ideas why ?

The ModalPopupExtender and the popup control have to be inside the UpdatePanel for UpdateProgress to be activated.



Hi,

Here an example of how to procede with.

<asp:UpdatePanelID="UpdatePanel1"runat="server"UpdateMode="Conditional">

<ContentTemplate>

<!-- Place here your ModalPopupExtender and the popup control -->

</ContentTemplate>

</asp:UpdatePanel>

<asp:UpdateProgressID="UpdateProgress1"DynamicLayout="false"runat="server"DisplayAfter="50">

<ProgressTemplate>

<spanstyle="font-family: Trebuchet MS; color: #ffffff;">Chargement...</span</ProgressTemplate>

</asp:UpdateProgress>

<ajaxToolkit:AlwaysVisibleControlExtenderID="AlwaysVisibleControlExtender1"runat="server"TargetControlID="UpdateProgress1"HorizontalSide="Center"VerticalSide="Middle"HorizontalOffset="0" />

Kind regards,


Ok,

Thanks both, I try to take look at this bit more today.


I tried this and it works, thanks !

One question though, why is AlwaysVisibleControlExtender needed, because the examples I have seen are done without this ? I always thought that UpdateProgress would be the only control needed here.


Happy to see that it works.

k000der:

I tried this and it works, thanks !

One question though, why is AlwaysVisibleControlExtender needed, because the examples I have seen are done without this ?

This extender is just here for managing the UpdateProgressExtender position. As you can seeHorizontalSide="Center"VerticalSide="Middle"

are for specifying the position in the screen where you would like to have the loading displayed, and even if you are scrolling up and down inside the page, you'll see that the position will always stay where you define it.

Kind regards,


Ok, now I see why it's needed. Thanks again.

UpdateProgress not reacting to LinkButtons in MultiView and FormView

I have a Content Page with two UpdatePanels. The first one has a FormView inside it and second one has MultiView with several Views. In each of this views I have a GridView in it. I change the views by LinkButtons that are also in the same UpdatePanel.

My problem is that none of the PostBack events in the UpdatePanels seem to fire the UpdateProgress. However, if I add a third UpdatePanel with a Label and a Button whith the following code, it does react to the Button click.

ProtectedSub btnTest_Click(ByVal senderAsObject,ByVal eAs System.EventArgs)

System.Threading.Thread.Sleep(3000)

lblTest.Text = DateTime.Now.ToString()

EndSub

But it still won't react to the events in the other two panles. Am I doing something wrong? All help would be greatly appriciated.

Thank you.

One more thing:

I can also move the Label and the Button to one of the exisiting UpdatePanels and the Button Click event does fire the UpdateProgress correcctly.


I also have two DropDownLists in the FromView (located inside a UpdatePanel) with PostBack events. Shouldn't that trigger the UpdateProgess?

Anyone?Tongue Tied

Thank you.


I did some futher testing and noticed if I copy the following in the LinkButton Click Sub, the UpdateProgress shows for that 3 seconds:

System.Threading.Thread.Sleep(3000)

So basically it seems only to work when sleeping but not when doing actually something, like sorting data in the GridView.Huh?

Is there anyway to fire the UpdateProgress manually?


Found an interesting link that almost (but not quite) handels my problem:

http://smarx.com/posts/why-the-updateprogress-wont-display.aspx


I tryed to use UpdatePanelAnimationExtender instead and found out a strage thing. When using the following code clicking the button that does that sleep thing, everything works fine. But when I do any other action on the that UpdatePanel (click a LinkButton that chages the active View, sort data in the GridView) the OnUpdating animation (FadeOut) only begins and then stops for several seconds until the data is rendered and then the OnUpdated animation (FadeIn) runs entirely. Strange!Hmm

<cc1:UpdatePanelAnimationExtenderID="UpdatePanelAnimationExtender1"runat="server"TargetControlID="upnDataTabs">

<Animations>

<OnUpdating>

<FadeOutDuration="1"Fps="40"/>

</OnUpdating>

<OnUpdated>

<FadeInDuration=".5"Fps="20"/>

</OnUpdated>

</Animations>

</cc1:UpdatePanelAnimationExtender>

I seem to be talking to myself here... MUST TAKE MY MEDICAIONIndifferent

UpdateProgress panel positioning

I have a page that has a datagrid that can be quite long. I don't want to page it so a user sometimes scrolls down and then clicks a button in the grid.

The issue is that the updateprogress image is up at the top of the page and if a user scrolls and then clicks in the grid they don't see the progress image because it is up top.

Is there a way to put the updateprogress panel where the user clicked instead of up top in a set position all the time?

Hi,

You can set the position of the updateprogress image via javascript according to the button's position.

Thanks

UpdateProgress panel in a Gridview Row

Hi,

I have a linkbutton on gridview row that performs a function related to the row when it is clicked. I am trying to add an updateprogress Panel to each row to allow the user to know somethign is happening when button is clicked. I can not get this to work. in the row template I have the updateprogress panel and tied the event to the buton click on the row and basically all update panels in the rows show up and nothing happens when I click on a button. Does anybody have any ideas how to go about updateprogress in GridView Row?

Thanks,

Mo

Hi ,

From what I understand.

Why do you want dedicated UpdateProgress Panels for each row ? Cant just one Progress panel suffice?

If its a question of letting the user know which row is being updated, go with CSS / setLocation() to set the location of the Updateprogress Panel on the Page upon clicking the button

Thanks,

Phanatic


Hi,

The reason is wht you suggested. I have a progresspanel on top of the page but when a row is updated it may not be visible. I am not familia with CSS/SetLocation. Could you tell me more?

Thanks,

Mo

updateprogress panel for onLoad Event

I am creating a dashboard where I have four quadrants on the page. Each quadrant show data for a sql query. When the page loads I fire off all four queries to retrieve the data. I want to be able to show a progress indicator graphic inside of each quad as the data is retrieved and then rendered. How do I get the graphic to display in each quad as the page is loading?

Hi Joee,

UpdateProgress only shows during an asynchronous postback. In your situation, it won't be shown because it is a synchronous post back only. So we should add four UpdatePanel and its associated UpdateProcess to the page. When the page is shown, we force the four UpdatePanels be refreshed with the datas obtained from Database. To refresh the UpdatePanel, we should use __doPostBack("UpdatePanel's ClientID",""); or fire its trigger.

Hope this helps.

Best regards,

Jonathan


Jonathan, do I use JavaScript for the __doPostBack() and do I just put that in the head of the page?


Hi Joee,

joee:

do I use JavaScript for the __doPostBack()

Yes, but not the only way. You can put a hidden button which is the trigger of the four UpdatePanels and use Javascript to fire its click event. Also , we have other similar ways.

I hope this help.

Best regards,

Jonathan

Updateprogress panel does not disappearing

Hello:

I have a web page with updatepanel and updateprogress. In each callback, updateprogress is showed with a panel "loading".

My problem is that, if I call other web page that opens one PDF in other window, updateprogress does not disappear from the screen:

In button click I have:

Response.Redirect(

"getDocument.aspx",false); //This page does not load on same explorer. It is opened in other window

I have tried adding code at bottom of this sentence, like "UpdatePanel1.Update();" or updateprogress1.visible=false, but no way.

Any ideas?

Thanks and regards

How you are loading the response in another explorer using Response.Redirect or are you opening the window from the client side?

refer this tutorial also:

http://ajax.asp.net/docs/tutorials/ProgrammingUpdateProgress.aspx

referDisplaying Update Progress Using Client Script in the above page.This describes how to intercepte page request manager lifecycle.


Hello and thanks by responding:

I am calling a web page called Getdocument.aspx from code behind (on rowcommand of datagrid). Not from client-side.

This web page "GetDocument.aspx", generates a PDF file with Response.binaryWrite and open it in a new browser. But caller page remains or must remain active.

Regards

UpdateProgress panel

I'm using the updateprogress panel on my pages and when its "running" it moves my grid down on the page, is it possible to show it in a pop up window or show it overlaying my grid?

In essence, when I'm showing my "Processing" I want it either in a pop window or overlaying my grid view some how. can this be done?

Hi IGotYourDotNet,

You can take a look at theModalPopup orAlwaysVisibileControl because I think these have both been used by people on this forum for showing update progress.

Thanks,
Ted

ok thanks, I'll take a look at them.

also I currently have it on the page running and when the page errors out it shows a javascript alert box and doesn't take the user tomy error page. Is there a way to not show the javascript alert box and take them to my error page with using the updateProgress?


IGotYourDotNet:

I'm using the updateprogress panel on my pages and when its "running" it moves my grid down on the page, is it possible to show it in a pop up window or show it overlaying my grid?

In essence, when I'm showing my "Processing" I want it either in a pop window or overlaying my grid view some how. can this be done?

If I'm understanding correctly, I think you can just put the contents of your updateprogress info inside of a div and set the z-index. Like this:
1<atlas:UpdateProgress ID="UpdateProgress1" runat="server">2 <ProgressTemplate>3 <div style="z-index:100;position:absolute;left:10px;top:0px;">4 Loading...5 </div>6 </ProgressTemplate>7</atlas:UpdateProgress>

This will also position the progress at the very top left of the browser


I want it centered on the page, not in the corners of the browsers

IGotYourDotNet:

I want it centered on the page, not in the corners of the browsers

Just change the div style to this:

<div style="z-index:100;position:absolute;left:50%;top:50%;">


yeah i got it to work but I don't like how it looks. I'm going to look at the modal/popup to see if I can get that to work.

Also in using this, how can I still take my users to the error page (if it happens) and not show the javascript alert window like it currently does?


Hi,

I'm not very familiar withUpdateProgress, but if you ask this in the"Atlas" UI forum you should be able to find out.

Thanks,
Ted

UpdateProgress on top and dimming of page

I have seen this used in several places but have yet to see how to do it. When a process is initiated and the UpdateProgress is shown, it is shown on top of everything else on the page and it dims the whole page and everything else on it to bring attention to the progress control. I am assuming that it is just some layer made to be transparent but like I said, I can't find anything about it. Can someone give me some more information or better yet, point me to a tutorial?

Thanks in advance!

Try to take a look at this reading to?get?some?ideas?-?http://ajax.asp.net/docs/overview/UpdateProgressOverview.aspx#HowTheyWork.
You?can?implement the progression through?threading?sleep,asp:UpdatePanel and asp:UpdateProgress.
Wish the above can help you.

Updateprogress on page_load ?

I have a long running process that might take several seconds to populate a control. Id like to show a progress indicator while this is being done. Anyone got an example of showing an updateprogress during page_load ? Maybe I can just use javascript to invoke a button click event on a non-visible button and have it start off the process ?
 here's a quick example:
var $user_updateProgress=Sys.Application.findComponent('ctl00_WorkingArea_Container_User_list1_UserLookupProgress');
 I had an UpdateProgress control named UserLookupProgress which I wanted to display. When the page loads, the control gets loaded into a javascript Sys.UI.Control.
So I needed to access it and it was driving me nuts! so I took a look at the source and figured out how they were doing it. Ultimately you need to use the findComponent method
of the Sys.Application class. The thing I could not figure out is why I had to reference the fully qualified ClientID in order to gain reference to my control.
From there I was able to show/hide the control.
 Hope this helps.
 P.S. if anyone has a better way , PLEASE chime in ;)


I want to show a updateprogress while my page loads. There is a tree that is populated with a large amount of data.

i have encounter same problem b4, that need to load a large data on the page load

but the interface will hang untill all the data was process.

i did a silly job to solve this problem

add a timer that run only once, set it to false by default, then on pageload and Ispostback=false, enable the timer run only once.

in the timer tick event bind the data.

thus, the databind is start after page load, and updateprogress working in this way too.

UpdateProgress progress property: UpdatePanelID. Will this ever be available ?

Hi, I was just wondering if will ATLAS ever have this property for UpdateProgress, so this way we could have several UpdateProgress controls, each one showing only with their associated UpdatePanel is being updated. I think it's something "essential" and I'm a bit worried about how this feature is still not available. Maybe is not possible for some reason ??

Eric

hello.

well, i guess this isn't necessary in the current release because you can only have one partial postback at a time. currently, i'd be happy if i was able to get a reference to the updatepanel that started the partial postback (and this is possible because the pagerequestmanager mantains a reference to it internally - it simply doesn't have a property that let's us get that info!


I have a situation where it is necessary. I have two UpdatePanels and would like to show the UpdateProgress on top of my UpdatePanel. If I could associate the UpdateProgress with the UpdatePanel then this would be easy because when the UpdatePanel is sending data back and forth to the server it would show only the appropriate UpdateProgress control.
I'm surprised too why this has not been added yet. It's more intuitive to the user when the loading indicator only appears in the specific section of the page that is updating.
lookherefor a javascript/css solution. have not tried it out yet though.
the noverber CTP has an AssociatedUpdatePanelID property on the UpdateProcess control. This allows you to tell the updateprogress to display when the desired update panel is posting back.

UpdateProgress problem with December CTP

Hi, can someone please tell me why the UpdateProgress doesn't apear?

<%@dotnet.itags.org. Page Language="C#" %
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
<script runat="server">
protected void Page_Load(object sender, EventArgs e) {
btn.Click += new EventHandler(btn_Click);
}

void btn_Click(object sender, EventArgs e) {
System.Threading.Thread.Sleep(1000);
}
</script
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" EnablePartialRendering="true" runat="server" />
<div>
<asp:UpdatePanel ID="up1" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger EventName="Click" ControlID="btn" />
</Triggers>
<ContentTemplate>
<%= DateTime.Now.ToString() %>
</ContentTemplate>
</asp:UpdatePanel>
<asp:Button ID="btn" runat="server" Text="Button" />
<asp:UpdateProgress ID="progress" runat="server" AssociatedUpdatePanelID="up1">
<ProgressTemplate>
<span>Loading...</span>
</ProgressTemplate>
</asp:UpdateProgress>
</div>
</form>
</body>
</html>

Hey :)

is this a known problem or I'm doing something wrong?


I've readthis post but this is not what I want. I want every update panel on my page to have it's own update progress. Something like this:

<%@. Page Language="C#" %
<script runat="server">

protected void Page_Load(object sender, EventArgs e)
{
btn1.Click += new EventHandler(btn_Click);
btn2.Click += new EventHandler(btn_Click);
}

void btn_Click(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(1000);
}

</script
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">

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

<asp:Button ID="btn1" runat="server" Text="Btn1" />

<asp:UpdatePanel ID="up1" runat="server" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btn1" EventName="Click" />
</Triggers>
<ContentTemplate>
<asp:Panel ID="panel1" runat="server" style="background-color:#ccc;">
<%= DateTime.Now.ToString() %>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel
<asp:UpdateProgress ID="uProgress1" AssociatedUpdatePanelID="up1" runat="server">
<ProgressTemplate>
<span>Loading panel 1</span>
</ProgressTemplate>
</asp:UpdateProgress
<br /
<asp:Button ID="btn2" runat="server" Text="Btn2" /
<asp:UpdatePanel ID="up2" runat="server" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btn2" EventName="Click" />
</Triggers>
<ContentTemplate>
<asp:Panel ID="panel2" runat="server" style="background-color:red;">
<%= DateTime.Now.ToString() %>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel
<asp:UpdateProgress ID="uProgress2" AssociatedUpdatePanelID="up2" runat="server">
<ProgressTemplate>
<span>Loading panel 2</span>
</ProgressTemplate>
</asp:UpdateProgress
<div>
</div>
</form>
</body>
</html

How to make this work? And the trigger buttons to be outsite the update panels...

10x


I've just read that :)

You can associate theUpdateProgress control with a singleUpdatePanel control by setting the progress control'sAssociatedUpdatePanelID property. In that case, theUpdateProgress control displays a message only when a postback originates inside the associatedUpdatePanel control.

sorry :)

Updateprogress problem

I am new to AJAX. And I don't understand why this doesn't update the label. The problem started on another page with Placeholders that don't get updated if I use UpdatePanels.

Thanks Asger

<%@dotnet.itags.org.PageLanguage="VB" %>

<%@dotnet.itags.org.RegisterAssembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"Namespace="System.Web.UI"TagPrefix="asp" %>

<%@dotnet.itags.org.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="ajaxToolkit" %>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<scriptrunat="server">

ProtectedSub tbCity_TextChanged(ByVal senderAsObject,ByVal eAs System.EventArgs)

lbl1.Text = tbCity.Text

EndSub

</script>

<htmlxmlns="http://www.w3.org/1999/xhtml">

<headrunat="server">

<title>Untitled Page</title>

</head>

<body>

<formid="form1"runat="server">

<div>

<asp:ScriptManagerID="ScriptManager1"runat="server">

</asp:ScriptManager>

<asp:UpdateProgressID="UpdateProgress1"runat="server">

<ProgressTemplate>

<div>

<asp:ImageID="Image1"runat="server"ImageUrl="~/images/vent.gif"ImageAlign="Top"/>

</div>

</ProgressTemplate>

</asp:UpdateProgress>

<asp:UpdatePanelID="UpdatePanel2"runat="server">

<ContentTemplate>

<asp:TextBoxID="tbCity"runat="server"AutoCompleteType="None"autocomplete="off"Width="200px"AutoPostBack="true"OnTextChanged="tbCity_TextChanged"/><br/>

</ContentTemplate>

</asp:UpdatePanel>

<asp:Labelrunat="server"ID="lbl1"/>

</div>

</form>

</body>

</html>

AsgerJornow:

I am new to AJAX. And I don't understand why this doesn't update the label. The problem started on another page with Placeholders that don't get updated if I use UpdatePanels.

Hi asger,

Your setup is wrong!

The label doesn't get updated because it is NOT on this updatepanel!!!!

Your textbox should be outside the updatepanel, the label inside, then define the textbox as a trigger of the updatepanel.

Or just place them both on the updatepanel.

Kind regards,
Wim


Thank you, now I get the picture. And it seems to be working.

Kind regards
Asger J?rnow

UpdateProgress Problem

I'd like to show the update progress template in the center of div, which content is updated with update panel. I tried to do it with z-index.. but it works only with absolute positioning so it can be centered only in the whole browser window. What should i do to make it work in the right way? =)

Here is a simple illustration of the feature i need

*****************Update Panel*************
* *

* *

* Loading... *

* *

* *

**********************************************


I have anarticle on creating a modal UpdateProgress. It uses absolute positioning, but you can use relative positioning to position the message within your container. There is ademo available as well... you can use Firebug to mess around a bit with the styles in real-time (just disable the visible=hidden style on the UpdateProgress' main DIV).

Hope this helps.

-Damien


Everything work nice when we use absolute positioning.. but with realtive positioning z-index doesn't work so i failed to put it to foreground.

According tohttp://msdn2.microsoft.com/en-us/library/ms533005.aspx

It is quite possible that relatively positioned elements will overlap with other objects and elements on the page. As with absolute positioning, you can use the z-index attribute to set thez-index of the positioned element relative to other elements that might occupy the same area. By default, a positioned element always has a higher z-coordinate than its parent element so that it will always be on top of its parent element.

I also messed around with the styles on the sample I sent you using FireBug and verified that I was able to set the z-index on a relative positioned element. For example:

#processMessage {

background-color:#FFFFFF;

border:1px solid #000000;

left:43%;

padding:10px;

position:relative;

top:-300px;

width:14%;

z-index:1001;

}

-Damien


You are looking like this one

http://mattberseth.com/blog/2007/06/aspnet_ajax_canceling_an_async_1.html


Thx! Look like it's what i need =)

UpdateProgress Problem

I am running Atlas on a Win 2K3 Server and I installed the latest version of Atlas today. I created a simple hello world page, which runs as expected. However, when I add an UpdateProgress control and try to view the page, the following two alert boxes appear (in order):

"Assertion Failed: Could not resolve reference to object named "_pageRequestManager" for "dataContext" property on object of type "Sys.Binding"

"Assertion Failed: No data context available for binding with ID"" and dataPath "inPostBack" on object of type "Sys.Binding"

The ASPX page that works correctly is:

<%@dotnet.itags.org. Page Language="C#" AutoEventWireup="true" %>
<script runat="server">
protected void Button1_Click(object sender, EventArgs e)
{
lbTest.Text="Hello World!";
}
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Atlas Test</title>
</head>
<body>
<form id="form1" runat="server">
<atlas:ScriptManager id="ScriptManager1" runat="server"></atlas:ScriptManager>

<atlas:UpdatePanel id="update1" runat="Server" Mode="Conditional">
<ContentTemplate>
<asp:Label id="lbTest" runat="server">This is a test</asp:Label>
<asp:Button id="Button1" runat="server" Text="Test Atlas" OnClick="Button1_Click" />
</ContentTemplate>
</atlas:UpdatePanel>
</form>
</body>
</html>

The ASPX page that fails is:

<%@dotnet.itags.org. Page Language="C#" AutoEventWireup="true" %>

<script runat="server">

protected void Button1_Click(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(2000);
lbTest.Text="Hello World!";
}

</script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Atlas Test</title>
</head>
<body>
<form id="form1" runat="server">
<atlas:ScriptManager id="ScriptManager1" runat="server"></atlas:ScriptManager>

<atlas:UpdatePanel id="update1" runat="Server" Mode="Conditional">
<ContentTemplate>
<asp:Label id="lbTest" runat="server"></asp:Label>
<asp:Button id="Button1" runat="server" Text="Test Atlas" OnClick="Button1_Click" />
</ContentTemplate>
</atlas:UpdatePanel>

<atlas:UpdateProgress ID="ProgressIndicator" runat="server">
<ProgressTemplate>
<div id="progressArea">
Loading the data, please wait... <asp:Image ID="LoadingImage" runat="server" ImageUrl="~/img/spinner.gif" />
</div>
</ProgressTemplate>
</atlas:UpdateProgress>
</form>
</body>
</html>

My web.config file looks like this:

<?xml version="1.0"?>

<configuration>

<configSections>
<sectionGroup name="microsoft.web" type="Microsoft.Web.Configuration.MicrosoftWebSectionGroup">
<section name="converters" type="Microsoft.Web.Configuration.ConvertersSection"/>
</sectionGroup>
</configSections>

<microsoft.web>
<converters>
<add type="Microsoft.Web.Script.Serialization.Converters.DataSetConverter"/>
<add type="Microsoft.Web.Script.Serialization.Converters.DataRowConverter"/>
<add type="Microsoft.Web.Script.Serialization.Converters.DataTableConverter"/>
</converters>
</microsoft.web>
<system.web>
<compilation debug="true"></compilation>

<pages>
<controls>
<add namespace="Microsoft.Web.UI" assembly="Microsoft.Web.Atlas" tagPrefix="atlas"/>
<add namespace="Microsoft.Web.UI.Controls" assembly="Microsoft.Web.Atlas" tagPrefix="atlas"/>
</controls>
</pages>

<authentication mode="Forms" ></authentication>

<xhtmlConformance mode="Strict"/>

<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" type="Microsoft.Web.Services.ScriptHandlerFactory" validate="false"/>
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="Microsoft.Web.Services.ScriptModule"/>
</httpModules>

</system.web>
</configuration>

I pulled the UpdateProgress directly from a sample online, and I can't figure out why it doesn't work.

Can anyone spot any obvious errors? Are there trust issues related to the DLL that holds the UpdateProgress class?

Any help, leads or links would be helpful - thanks.

Update - the first example I posted above DOES NOT WORK. The postback was so fast I mistakenly thought it was working.

No Atlas scripts are working above - anyone have any ideas?


I discovered the problem. I had forgotten to add an "EnablePartialRendering"attribute to true on my ScriptManager.

The first page above had a pagewith just an UpdatePanel. The pageworked, but it posted back instead of updating through atlas. When I added an UpdateProgress, I got thefollowing two error messages:

"Assertion Failed:Could not resolve reference to object named "_pageRequestManager" for"dataContext" property on object of type "Sys.Binding"

"Assertion Failed:No data context available for binding with ID"" and dataPath"inPostBack" on object of type "Sys.Binding"

I couldn't find anyinformation on these error message, and I assumed there was some problem in theinstallation. When I included the "EnablePartialRendering"attribute it solved the problem. I'msure as the Atlas documentation expands, this issue will be covered morethoroughly.

Thaks to Scott Gu and Matt Gibbs for taking some time to respond to my questions about it.
It is possibly related with this problemhttp://forums.asp.net/thread/1243525.aspx

UpdateProgress Position in middle of screen

Hi,

I have various updatepanels on the same page. I want to have 1 updateprogress on the same page and depending on which updateprogress is updating that the updateprogress move to the middle of the updateprogress that is updating. The following code below allows me to position the updateprogress in the centre of the page but when the the page is scrolled down the updateprogress doesn't move its position appropriately.

Can anyone help?

I have inspected the values of the document.body.scrolltop and it is always at 0. How can change the position of the updateprogress when the user scrolls the page?

<

scriptlanguage="javascript"type="text/javascript">

function

adjustDivs(){var df=document.getElementById("updateprogressdiv");

df.style.position=

'absolute' ;

df.style.left =document.body.offsetWidth/2 + document.body.scrollLeft -150;

df.style.top = document.body.offsetHeight/2 + document.body.scrollTop -50;

}

window.onload=adjustDivs;

window.onresize=adjustDivs;

window.onscroll=adjustDivs;

</

script>

did you ever figure how to make the updateprogress display in the center of the page even when you scroll the page down

or does anybody have any other ides on how to make this happen


hello.

you can easilly do that with the AllwaysVisibleControlExtender available on the atlas toolkit.


Hi,

I've come up with some DHTML to always center the animated gif on your screen, AS WELL AS disable all elements by throwing a transparent IFRAME z-indexed to the top. Keep in mind that I have NOT tested this with other browsers, only in IE6. If anyone wants to cross-browser/cross-platform modify it, be my guest.

<atlas:UpdateProgressID="uppMain"runat="server">

<ProgressTemplate>

<iframeframeborder="0"src="about:blank"

style="border:0px;position:absolute;z-index:9;left:0px;top:0px;width:expression(this.offsetParent.scrollWidth);height:expression(this.offsetParent.scrollHeight);filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=75, FinishOpacity=0, Style=0, StartX=0, FinishX=100, StartY=0, FinishY=100);"></iframe>

<divstyle="position:absolute;z-index:10;left:expression((this.offsetParent.clientWidth/2)-(this.clientWidth/2)+this.offsetParent.scrollLeft);top:expression((this.offsetParent.clientHeight/2)-(this.clientHeight/2)+this.offsetParent.scrollTop);">Please Wait...<br/><imgsrc="/_images/statusbar.gif"/></div>

</ProgressTemplate>

</atlas:UpdateProgress>


Works Perfect..Big Smile..Thanks for the code...

Okay... dude... that "left: expression((t..." line is absolute GENIUS!!! I had NO idea that you could do that! It even works in a stylesheet!

You are the MAN! Unless you're a girl, in which case you're... well, still the man! :D


Seriously, you guys couldn't have bumped this thread a couple hours ago? I just finished my own attempt at using UpdateProgress to disable page controls... and yours is better. :(

Umm,

I was under the impression that CSS "expression" is not standard. I know it works in IE, but does it work in Firefox. I know we've had problems before, because I don't think Firefox recognizes it. I could be wrong, though. You might want to cross-browser test it.


Hi guys/gals,

Tadmeister's introduction of Javascript within CSS was absolutely brilliant i thought also. So along with some help from another article on some Javascript i decided to do some customisation of my own. But instead of using an iframe (if anyone has a problem with it), I used a Panel for the overlay and another Panel within it for the "loading..." text. Here is a snippet in case anyone wants to try it out. I've tested it and it works nicely in Firefox2 & IE7, but IE6 gave me some problems with the vertical positioning. I used a hack for IE6, and anyone is welcome to improve on it!

<ajax:UpdateProgress ID="UpdateProgress1" runat="server">
<ProgressTemplate>
<asp:Panel ID="Panel1" CssClass="overlay" runat="server">
<asp:Panel ID="Panel2" CssClass="loader" runat="server">
Loading...
</asp:Panel>
</asp:Panel>
</ProgressTemplate>
</ajax:UpdateProgress>

and the CSS for it:

.overlay {
position: fixed;
z-index: 99;
top: 0px;
left: 0px;
background-color: #FFFFFF;
width: 100%;
height: 100%;
filter: Alpha(Opacity=70);
opacity: 0.70;
-moz-opacity: 0.70;
}
* html .overlay {
position: absolute;
height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px');
width: expression(document.body.scrollWidth > document.body.offsetWidth ? document.body.scrollWidth : document.body.offsetWidth + 'px');
}
.loader {
z-index: 100;
position: fixed;
width: 120px;
margin-left: -60px;
top: 50%;
left: 50%;
}
* html .loader {
position: absolute;
margin-top: expression((document.body.scrollHeight / 4) + (0 - parseInt(this.offsetParent.clientHeight / 2) + (document.documentElement && document.documentElement.scrollTop || document.body.scrollTop)) + 'px');
}

Yea, I know...the margin-top expression for IE6 is not the best, but if someone can make it work properly, be my guest. Alternatively check out: www.codeproject.com/ajax/modalupdateprogress.asp for Ting Huang's custom ajax extender.

Cheers!
Shalan99


Is there a way to get this to cover only a div or something? I have some web parts that do updates, and would like it to be centered within those, but I can't get that to work.

Hi Sarvis,

There are ways to achieve this. Raj Kaimal has a great bunch of control/extenders...one of which does what u want it to do, minus centering it in the associated control itself. Check it out @.: http://weblogs.asp.net/rajbk/archive/2007/01/08/using-the-updateprogress-control-as-a-modal-overlay.aspx

Another way to do this jus came to mind, but let me test it out first before i post any code.


Cheers!


Thank you very much. Great post. Tadmeister


Hi Tadmeister,

I implemented above code it worked, but receiving CSS validation is not valid for property left/top. How do I avoid receiving these error in .aspx page.

Please help...


Thanks for that, works fine

updateprogress position in Firefox (urghh!)

Hi,

I have an updateprogress control that displays nicely in the middle of the screen, but only in IE.

The code is...

<

atlas:UpdateProgressid="loadingProgress"runat="server"><ProgressTemplate>

<divstyle="height:40px;width:250px;position:absolute;z-index:10000;left:expression((this.offsetParent.clientWidth/2)-(this.clientWidth/2)+this.offsetParent.scrollLeft);top:expression((this.offsetParent.clientHeight/2)-(this.clientHeight/2)+this.offsetParent.scrollTop+58); background-repeat: repeat-x; text-align: center; vertical-align: middle; border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid; background-image: url(Images/updateProgressBk.png);">

<

imgstyle="z-index: 109; left: 80px; position: absolute;top:22px"src="images/progressbar_microsoft.gif"/></div></ProgressTemplate></atlas:UpdateProgress> But in Firefox (dont like it myself but some users here use it), it positions on the top left of the screen.

Anyone know a fix, or does Firefox not know about "this.offsetParent.clientHeight" etc?

Thanks

Anyone know how to position the update progress control in the center of the page when viewing from Firefox?

UpdateProgress Template and the Control Toolkit

I have an

atlas:UpdateProgress Template on the same page as some cascading drop downs. I have put in a large (5 seconds) delay on the webservice populating the dropdowns but still don't see the ProgressTemplate.

Does the UpdateProgress Template work with the control toolkit or is it just for UpdatePanels?

The Toolkit controls do not natively work with Atlas's UpdateProgress control. I looked into this briefly just now and it doesn't seem like the UpdateProgress control can be used in this way. Rather, it seems to tie itself directly to the "in postback" status of the relevant page. Since there are no postbacks in the CascadingDropDown scenario, UpdateProgress doesn't seem relevant. Sorry about that!

UpdateProgress taking up space

I've placed an UpdateProgress control on my page. But it's taking up space on the form when not displayed. Is there a way to make it so that when it's not showing it won't take up any space on the page?

Never mind. I have so many panels, tables and other controls, that it realy makes it difficult to identify any problems. The UpdateProgress wasn't the issue.

UpdateProgress subcontrols modification

I have the following code in place on my page. What I would like to do is to dynamically set the
lblProcessingRequest Text property during page load, because the site have some local language
customization build in.

I have tried a lot of things, but can't manage to get it to work.

<asp:UpdateProgressID="UpdateProgress"runat="server"AssociatedUpdatePanelID="UpdatePanel"DisplayAfter="100"DynamicLayout="False">

<ProgressTemplate><imgsrc="images/ProcessAnimation.gif"align="absMiddle"> <asp:labelID="lblProcessingRequest"Text="Processing request..."runat="server"Font-Bold="True"></asp:label></ProgressTemplate></asp:UpdateProgress>

The content is a template, so you can't immediately get at the controls like you normally can.

The template is instantiated during PreRender, so you should be able to hook into the Page's PreRenderComplete event, then do a FindControl on the update progress to get to the label:

private void PreRenderCompleteHandler(object sender, EventArgs args) {
Label l = (Label) UpdateProgress.FindControl("lblProcessingRequest");
l.Text = ""; // some localized text
}

Whenever you do this sort of thing, please, please be wary of ViewState. You should disable ViewState on that label, or you will be persisting viewstate data that doesn't need to be. If you are doing this for many labels on the page it could really add up to a problem. Read my (lengthy) article on ViewState, linked in my signature, if you have time.


ProtectedSub Page_PreRender(ByVal senderAsObject,ByVal eAs System.EventArgs)HandlesMe.PreRenderTryCType(UpdateProgress.FindControl("lblProcessingRequest"), Label).Text ="Some local Text"
Catch exAs Exception
EndTryEndSub

Sorry to say that this doesn't work. The control is not found. Couldn't this be because the label only is visible during the UpdateProgress, and at all
other time is hidden? I even tried hooking the control in the UpdateProgress PreRender method, but that didn't work eighter...


Ok, was I litte to hasty here.

Protected

Sub Page_PreRenderComplete(ByVal senderAsObject,ByVal eAs System.EventArgs)HandlesMe.PreRenderComplete

Hooking into the PreRenderComplete works fine!

UpdateProgress stops working after first firing

Running locally, my apps work fine. When I deploy to a remote server, my UpdateProgress controls stop working or work intermittently. The server is IIS6 on 2003. Sharepoint is running on the server but I have added scriptresource.axd and webresource.axd to excluded paths. Latest version of Ajax is installed. Seperate app pool. The hard thing is it works locally!! What else can i look at?? Here is the source:

<%@dotnet.itags.org. Page Language="C#" AutoEventWireup="true" CodeFile="UPTest.aspx.cs" Inherits="UPTest" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server" /> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Label ID="Label1" runat="server"></asp:Label> <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /> <asp:UpdateProgress ID="UpdateProgress1" AssociatedUpdatePanelID="UpdatePanel1" DisplayAfter="0" runat="server"> <ProgressTemplate> <img alt="progress" src="Images/indicator_green.gif" /> </ProgressTemplate> </asp:UpdateProgress> </ContentTemplate> </asp:UpdatePanel> </form></body></html>

-----------

using System;using System.Web.UI.WebControls;public partialclass UPTest : System.Web.UI.Page{protected void Button1_Click(object sender, EventArgs e) { System.Threading.Thread.Sleep(5000); Label1.Text = DateTime.Now.ToLongTimeString(); }}

I'm getting this issue as well.

Any one know of a fix / explanation?


i am experiencing this as well.

anyone??


NOTE: fixed this issue by adding the "DisplayAfter" property w/any value

<

asp:UpdateProgressID="progressPanel"DisplayAfter="1"runat="server">
Unfortunately this did not work for me...has anyone else found another solution to this by any chance?

I ended up just using the javascript events in the end to show and hide a div.

think they're called onbeginrequest and onendrequest or something similar

HTH


Ok, call me dense, but I am not seeing this event anywhere in the scriptmanager, updatepanel, or updateprogress control...could you point me in the right direction please?

http://ajax.asp.net/docs/ClientReference/Sys.WebForms/PageRequestManagerClass/PageRequestManagerBeginRequestEvent.aspx

http://ajax.asp.net/docs/ClientReference/Sys.WebForms/PageRequestManagerClass/PageRequestManagerEndRequestEvent.aspx


Martin,

Thank you for this....I thought you had it solved for me, but it seems I have hit another snag. It seems that after the first call the div I am using is removed from the DOM rather than just being set to hidden. I can no longer find it in the DOM inspector thus my Javascript call can not find the element the next time the panel comes around...what is strange is that it is being removed before the EndRequestHandler is called...so there must be an event between BeginRequestHandler and EndRequestHandler that seems to be removing the element from the DOM. Did you run into this problem or am I just lucky ;-)

Thanks in advance,

Josh


Is your div inside the Update Panel itself?

If so it may be getting replaced by the contents of the Ajax call.


Unfortunately I wish it was as trivial as that, but it is not inside my update panel. I am quite lost on what could be doing this...

Josh


Ok I have worked on this all day today and have made noprogress...here is my code, please someone tell me what I am doingwrong...
1<%@. Page Language="C#" MasterPageFile="~/site.master" AutoEventWireup="true" CodeFile="Default2.aspx.cs"2 Inherits="Default2" Title="Untitled Page" %>34<%@. Register src="http://pics.10026.com/?src=Modules/MainNavigation.ascx" TagName="MainNavigation" TagPrefix="uc1" %>5<%@. Register src="http://pics.10026.com/?src=Modules/Products/ProductSummaryDisplay.ascx" TagName="ProductSummaryDisplay"6 TagPrefix="uc2" %>7<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">8 <asp:ScriptManager ID="ScriptManager1" ScriptMode="Release" EnablePartialRendering="true" runat="server">9 </asp:ScriptManager>1011 <script type="text/javascript">12 Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler);13 Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);14 function BeginRequestHandler(sender, args)15 {16 var elem = args.get_postBackElement();17 ActivateAlertDiv('visible', 'AlertDiv');18 }19 function EndRequestHandler(sender, args)20 {21 ActivateAlertDiv('hidden', 'AlertDiv');22 }23 function ActivateAlertDiv(visstring, elem)24 {25 var adiv = $get(elem);26 adiv.style.visibility = visstring;27 }28 </script>2930 <div id='leftcontent'>31 <uc1:MainNavigation ID="MainNavigation1" runat="server" />32 </div>33 <div id='centercontent'>34 <div class='sectionheader'>35 <a href="<%=Page.ResolveUrl("~/default.aspx")%>">Home</a> >><asp:Label ID="lblBreadCrumb"36 runat="server"></asp:Label></div>37 <asp:UpdatePanel ID="UPanel1" ChildrenAsTriggers="true" runat="server" UpdateMode="conditional">38 <ContentTemplate>39 <asp:Panel ID="Panel1" runat="server" Height="50px" Width="700px" HorizontalAlign="Center">40 <div style="float: left;">41 <asp:LinkButton ID="btnDecreasePage1" runat="server" OnClick="btnDecreasePage1_Click"><< Previous ></div>42 <div style="float: left;">43 Page44 <asp:Label ID="lblCurrPage1" runat="server" Text="1"></asp:Label>45 of46 <asp:Label ID="lblTotalPages1" runat="server"></asp:Label></div>47 <div style="float: left; clear: right;">48 <asp:LinkButton ID="btnIncreasePage1" runat="server" OnClick="btnIncreasePage1_Click"> Next >></asp:LinkButton>49 </asp:Panel>50 <div style="float: right">51 Num Products Per Page:<asp:TextBox ID="txtProductsPerPage" runat="server" Text="6"52 AutoPostBack="true" MaxLength='4' Width="3em" OnTextChanged="txtProductsPerPage_TextChanged"></asp:TextBox> </div>53 <br />54 <asp:DataList runat="server" ID="productList" RepeatColumns="3" RepeatDirection="Horizontal"55 EnableViewState="False">56 <ItemTemplate>57 <uc2:ProductSummaryDisplay ID="ProductSummaryDisplay1" runat="server" ProductGUID='<%# Eval("ProductGUID")%>'58 ProductName='<%# Eval("ProductName")%>' ImageFile='<%# Eval("imageFile")%>'59 ProductID='<%# Eval("productID")%>' OurPrice='<%#Eval("OurPrice")%>' RetailPrice='<%#Eval("RetailPrice")%>'60 ShippingEstimate='<%#Eval("ShippingEstimate")%>' Rating='<%#Eval("Rating")%>'61 SKU='<%#Eval("SKU")%>' />62 </ItemTemplate>63 </asp:DataList>64 <asp:Panel ID="Panel2" runat="server" Height="50px" Width="250px" HorizontalAlign="Center">65 <div style="clear: left; float: left;">66 <asp:LinkButton ID="btnDecreasePage2" runat="server" OnClick="btnDecreasePage1_Click"><< Previous ></div>67 <div style="float: left;">68 Page69 <asp:Label ID="lblCurrPage2" runat="server" Text="1"></asp:Label>70 of71 <asp:Label ID="lblTotalPages2" runat="server"></asp:Label></div>72 <div style="float: left">73 <asp:LinkButton ID="btnIncreasePage2" runat="server" OnClick="btnIncreasePage1_Click"> Next >></asp:LinkButton>74 </asp:Panel>75 </ContentTemplate>76 </asp:UpdatePanel>77 <div id="AlertDiv" class="loadingbox" style="visibility:hidden;">78 <img src="images/spinner.gif" align="absmiddle" />  Processing...79 </div>80 </div>81 <div id='rightcontent'>82 </div>8384</asp:Content>85

Thank you in advance,

Josh


Your manual show/hide should work. The fact it isn't could be for the same reason the UpdateProgress wasn't working. Examine your document for possible missing closing tags, etc. Look at the rendered html instead of the aspx. Inside the update panel, the "<<" and ">>" in your next/previous buttons looks suspect. Encode them as >> and << (they almost look like html tags otherwise). If you have any <script src="http://pics.10026.com/?src="> tags make sure they are not of the self-closing variety. For example <script src="http://pics.10026.com/?src=.." type="text/javascript"></script>, not <script src="http://pics.10026.com/?src=.." type="text/javascript" />.

Is $get(elem) returning an element or null?


Well you sir hit the nail on the head, I had some open tags. It wasn't showing up on source view as an issue strangely enough. I just went down one by one.

Also thank you for pointing out my glaring mistake with the >> and <<, that is not normal practice for me in my defense....

Thanks again!

UpdateProgress stops working

Hello everybody,

my problem: I have a gridview in an update panel, and the gridviews header contains some DropDownLists for filtering data. Also the Gridview is enabled for Sorting

and Paging. All works fine. But to inform the user that the action he started is on the way, i included a UpdateProgress with a gif animation. So when the user starts filtering

or sorting the gif animation is shown and animated. But after a short time, it stands still. A second or two later, the GridView is bound completely and the gif disappears.

So something seems to block the UpdateProgress. What am i doing wrong ? the gif animation is on top of the gridview.

any hint is aprreciated, thanks a lot !

This happens when the browser is rendering the response... Haven't found really anything to do about it :(

-Damien

UpdateProgress slow to show even if DisplayAfter=0

Hi, I have an UpdatePanel with a bunch of buttons, checkboxes and combobox and a GridView. I also have an UpdateProgress set with DisplayAfter="0". Sometimes, when it's taking a while to process the data, the UpdateProgress doesn't show up for 2-3 seconds and then gets displayed.

Is there any reason why it wouldn't always show up instantly? Is the trigger to show the UpdateProgress sent from server or client?

I use this CSS style for the updateProgress, could this be the problem (using IE7)?

#UpdateProgress1 {top:50%;width:100%;position:fixed;text-align: center;background:#dd2;}
Thanks,
Christian

Is there any image in Update Progress..


No images. Here is what I use :

<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1"
DisplayAfter="0">
<ProgressTemplate>
<div style="height: 50px">
<br />
Loading data ...
<br />
</div>
</ProgressTemplate>
</asp:UpdateProgress>


Try to give a 100 value may be 0 is some default


Thanks for the suggestion, but itt didn't help. It just took a little longer to show :)


what browser r u using?


I tried both IE6 and IE7


Do you have mupliple UpdatePanels?

Do you have the latest ASP.Net AJAX 1.0?


I have a single UpdatePanel that takes most of the page and I have ASP.NET AJAX 1.0 that I downloaded about 2 weeks ago.

UpdateProgress Renders Differently in IE7

I am using an update progress control which contains an animated gif and then some text below. The style on the DIV creates a box around it. It renders fine in IE6 but IE7 the Please Wait...shows up outside the box...any suggestions? Here is the code and css style:

<asp:UpdateProgress ID="UpdateProgress1" runat="server">
<ProgressTemplate>
<Div class="wdeProgressIndicator">
<img src="http://pics.10026.com/?src=images/progressbar.gif" alt="Please Wait..." />
Please Wait...
</Div>
</ProgressTemplate>
</asp:UpdateProgress>

background-color: #ffffff;
margin: auto;
height: 10px;
width: 300px;
position: absolute;
left: 50%;
top: 40%;
margin-left: -150px;
margin-top: -5px;
border-right: #5d7b9d thin solid;
border-top: #5d7b9d thin solid;
border-left: #5d7b9d thin solid;
border-bottom: #5d7b9d thin solid;
padding-right: 5px;
padding-left: 5px;
padding-bottom: 5px;
padding-top: 10px;

If i do the following it works fine, so there has to be more html in the page, that is manipulating something. In any case, why not make the image a background-image on the div with the css, and rmeove the image tag all together, so the image is just part of the div anyway.

<html>
<style>
.wdeProgressIndicator{
background-color: #ffffff;
margin: auto;
height: 10px;
width: 300px;
position: absolute;
left: 50%;
top: 40%;
margin-left: -150px;
margin-top: -5px;
border-right: #5d7b9d thin solid;
border-top: #5d7b9d thin solid;
border-left: #5d7b9d thin solid;
border-bottom: #5d7b9d thin solid;
padding-right: 5px;
padding-left: 5px;
padding-bottom: 5px;
padding-top: 10px;
}
</style>

<body>
<Div class="wdeProgressIndicator">
<img src="http://pics.10026.com/?src=images/progressbar.gif" alt="Please Wait..." />
Please Wait...
</Div>
</body>
</html>


Good suggestion..thanks. That seems to work for now.

UpdateProgress RenderMode?

Yeah, this topic has been posted before, but not for a while...

I need to have an updateprogress render with display:inline style rather than display:block...

And no, wrapping it in a div, a span, using float, positioning, etc doesn't cut it... no matter what I do the image I'm displaying ends up on it's own line...

Any suggestions? It is possible a RenderMode property will be added before the final release?

Thanks

-Andy

There is no?RenderMode property?for?asp:UpdateProgress?in?Ajax?Beta?2.Let's?look?forward?to?the?next?Ajax?release?and?
wish?this?property?will?add?to?it.

I've discovered a work-around that seems to work in IE7, but not in Firefox...

Wrap the UpdateProgress with a <span> where the style is set to "display: inline-block;"

Like this:

<span style="display: inline-block;">
<asp:UpdateProgress ID="UpdateProgressOne" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
<ProgressTemplate>
<asp:Image ID="Image1" runat="server" ImageUrl="~/images/loading.gif" />
</ProgressTemplate>
</asp:UpdateProgress>
</span>

But like I said, it only works in IE...

-A


I tested your codes and found it worked fine IE 7.0 and FireFox,but not in Opera.Besides,I got the error message saying that "inline-block;" is not a valid property for "display".No matter what browsers you are using,the content of the associated UpdatePanel will be displayed all the time.Maybe this is caused by the defect?of?the?asp:UpdatePanel?control?in?Ajax?Beta?2?framework.Wish?this?could?be?eliminated?in?the?release?version.

UpdateProgress render inline option?

UpdateProgress always seems to render the contents of <ProgressTemplate> on a new line. Any simple way to have that render inline where it is placed?

You can to do this using css styles.

<styletype="text/css">
#updateProgress1
{
display:inline;
}
</style>

Make sure that the ID of your progress control is updateProgress1.

I could see that working except that the ID of my Progress control gets some extra naming container ID's attached to it. Not being a CSS master I wonder if it were wrapped with another DIV that displayed inline shouldn't that take care of it?


Yes you can do something like that.

<div id="enclosure">
<atlas:updateprogress ... >
</div>

You can use selector as follows

#enclosure div
{
display: inline;
}


The above suggestion doesn't seem to work - as the UpdateProgress DIV is styled inline (varying between "display:none" and "display:block") - the inline "display:block" overrides the stylesheet setting.

Best soultion I could come up with was to use the following code:

<p><span class="progress"> <atlas:UpdateProgress ID="updateProgress" runat="server"> <ProgressTemplate> <img id="Img1" runat="server" src="~/Images/Progress.gif" /> Updating... </ProgressTemplate></atlas:UpdateProgress></span><asp:Button ID="testButton" runat="server" Text="Refresh" /></p>  
span.progress{ position: absoulte; left:100px;}

Using,position:absolute will take the 'progress' span out of the document flow, thus not affecting other page elements. Setting just the "left" position will move the image across from the button (which is less than 100 pxels wide)

This is by no means elegant, but achieves a goal. (and it assumes you have spare space to the left of your update button).

Other variations on this soultion could place the update indicator at the top left/right of the screen - (something like gmail does)

Would be much better if the UpdateProgress control could rendereither as a Block or Inline element!

Alternatively to all of this, you could wrap the button and Progess control in a 2 cell table...


It would be good if a RenderMode property could be added to UpdateProgress in the same way as the UpdatePanel.

The RenderMode property can be either Inline or Block, and that causes it to either output a wrapper <span> or <div> accordingly.

Just seems that the UpdateProgress is missing that property (not in July 2006 CTP anyway)

Daniel.


Actually I have just tried enclosing the UpdateProgress with a span as so:-

<span class="progress"> <atlas:UpdateProgress runat="server" ID="up1"> <ProgressTemplate> <asp:Image ID="Image1" runat="server" ImageUrl="~/images/wait.gif" /> </ProgressTemplate> </atlas:UpdateProgress></span>
 and used
span.progress div{display: inline;}
 
which works fine (July CTP).

I have it working without the inline, a float: left; did the trick.

span.progress div
{
float:left;
}

UpdateProgress within treeView

hi...

i have treeView(populate onDemand) in updatePanel, and i want to add updateProgress animation or message, dynamically near to the selected node(parent node), someone have an idea how to implement that?

thanks...

Hi,
???Here are some sample codes about asp:TreeView working with asp:UpdateProgress for your reference.
??? <div>
<asp:UpdatePanel ID="UpdatePanel8" runat="server">
<ContentTemplate>
<asp:TreeView ID="tv" runat="server" OnSelectedNodeChanged="tv_SelectedNodeChanged">
<Nodes>
<asp:TreeNode Text="File" Value="File"></asp:TreeNode>
<asp:TreeNode Text="Edit" Value="Edit"></asp:TreeNode>
<asp:TreeNode Text="View" Value="View"></asp:TreeNode>
</Nodes>
</asp:TreeView>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress2" runat="server"
AssociatedUpdatePanelID="UpdatePanel8"
DisplayAfter="2000"
DynamicLayout="False">
<ProgressTemplate>
UpdatePanel1 is updating now!
<input type="button" id="AbortCallbackButton" value="Abort" onclick="AbortCallback()" />
</ProgressTemplate>
</asp:UpdateProgress>
<br />
This is text after the UpdatePanel and UpdateProgress controls.
<script type="text/javascript">
function AbortCallback()
{
Sys.WebForms.PageRequestManager.getInstance().abortPostBack();
}
</script>
</div
protected void tv_SelectedNodeChanged(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(10000);
}
Wish this can give you some helps.

UpdateProgress with DropDownList Controls (or others)

I have a UpdateProgress control that works with the submit button; how do I get it to work with a dropdown list that gets populated from a web service? Thanks.

Dan

I am not sure, if i had understood your problem correctly. An UpdateProgress control is attached to an update panel. So it doesnt matter if the post back is caused by a button or a dropdownlist. Make sure you have the dropdownlist in the updatepanel for which the updateprogress is attached.

Thanks

UpdateProgress with AssociatedUpdatePanelID not showing

I have a page withe 2 updatepanels & 2 updateprogress, when I set the AssociatedUpdatePanelID for each updateprogress control, neither is displayed when its associated panel is updated but when I remove the AssociatedUpdatePanelID, they work. But I need to set it. What can I do?

Can you post your asp.net code?

<

tr><td align="right">Country</td><td><asp:DropDownListID="ddlCountry"runat="server"DataSourceID="CountriesDS"DataTextField="CountryName"DataValueField="CountryId"AutoPostBack="True"AppendDataBoundItems="True"><asp:ListItemValue="0">-- Select Country --</asp:ListItem></asp:DropDownList></td></tr><tr><tdalign="right">City</td><td><ajax:UpdatePanelID="CityPanel"runat="server"UpdateMode="Conditional"><ContentTemplate><asp:DropDownListID="ddlCity"runat="server"DataSourceID="CitiesDS"DataTextField="CityName"DataValueField="CityId"><asp:ListItemValue="0">-- Select City --</asp:ListItem></asp:DropDownList>

<

ajax:UpdateProgressID="CityLoading"runat="server"AssociatedUpdatePanelID="CityPanel"><ProgressTemplate><imgsrc="../images/spinner.gif"align="absmiddle"alt="Loading..."></ProgressTemplate></ajax:UpdateProgress></ContentTemplate><Triggers><ajax:AsyncPostBackTriggerControlID="ddlCountry"/></Triggers></ajax:UpdatePanel></td></tr>

Hi, I have the same problem. The probem is with Triggers collection of UpdatePanel. It doesn`t work together with UpdateProgress.

Put that DropDownList inside UpdatePanel control and it will work.


Thanks it worked

UpdateProgress with a Response.Redirect

I have an UpdateProgress control to activate on a postback of a button control. The button_click event is performing a Response.Redirect to pull up a Report from SQL Reporting Server. The report comes up and the UpdateProgress bar is spinning on the page with the button. However, once the user closes the report and control is returned to the page, the UpdateProgress image is still there spinning.

How can I make the UpdateProgress bar to finish and go away?

Thanks,

Paul

Could you please post your code.

Is the UpdateProgress control inside an updatepanel?

JoeWeb


The UpdateProgress is outside of the UpdatePanel.

Protected

Sub ImgButPrint_Click(ByVal senderAsObject,ByVal eAs System.Web.UI.ImageClickEventArgs)Handles ImgButPrint.Click

Response.Redirect(PrintReports.printSchedule("Schedule3", Session.Item("companyId"), Session.Item("year"), 0))EndSub

The UpdateProgress displays a spinning wheel while the response.redirect happens. The Response.Redirect is opening a report from the report server as a .pdf file. So the redirect pops up a dialog asking user either to Open, Save, or Cancel the .pdf report file. Once the user selects their option and control is returned back to the original page the UpdateProgress image is still on the screen.

UpdateProgress Triggers

Hey gang.

I have a XmlDataSource (RSS Feed) bound to a DataList and I am curious how on initial load up I can display the update progress when the page is loaded?

I tried to do the following:

<Triggers> <atlas:ControlEventTrigger ControlID="XmlDataSource1" EventName="Transforming" /></Triggers>

I am really not sure how to tackle this. I know that the update progress occurs on executing server side code, but not sure how to attach it to data binding changes etc.

Thanks and take care!

hello.

well the updateprogess is a simple control that shows its content during a partial postback which might occur due to an updatepanel refresh. what you're trying to do (show progress while the processing is being done on the server side) can only be done during the initial page load or a complete postback (not during a partial postback!). there are several options that you can follow for that progress info during the rendering of the page ( I do believe thatwww.codeproject.com has several articles about it).


Thanks for your help!

How does Live.com show the RSS feed loading progress animation then when it is loading the feeds during the initial page load?

Thanks and take care.


hello.

well, i haven't used live.com for a while now. however, i'd say that what it does is show that info when it starts getting the info and then it removes it when it's finished. this is easilly achieved when you're using a web service to get the info (since it'll be donw asynchronously). btw, this is what happens when the panels postback. however, i do think that you only get the info that something is loading and don't get anything about the percentage of the operation being performed (which i assumed you needed in the previous post).

UpdateProgress throws javascript error when contained in a Panel with visible = false

If you put a UpdateProgress control inside a Panel control with visible=false, you will get a javascript error that is cannot find the elements used for the update progress functionality.

Anyone, seen this before and know of a workaround?

I get the same result in a MultiView when the UpdateProgress control is contained in a view that is not the current view.

Thanks,

Ryan

When you set Visible equal to false the HTML contained therein does not get rendered at all. You shouldn't need to explicitly hide the UpdatePanel as it should hide itself unless an Atlas postback is in progress.

If you do need to hid it, set the style of the panel to "display: none" and leave it visible. That way the HTML will be rendered but not shown on screen.


Thanks for the suggestion on display: none. This will work for Panel controls, but it won't work for pages using the MultiView control. I guess I'll have to get rid of MultiView and create several separate panels wnd manually control which one is shown and which ones are diplay: none.

UpdateProgressControl/UpdatePanel timeout

I have a main ASP.NET 2.0 web form (C# code-behind) that has an "inbox" that displays records from a database. The main web form has a AspTimer control and an UpdatePanel control that are used in concert to refresh the inbox every 2 minutes (120000ms) triggered by the timers Tick event. However, when a user creates a new record using another web form I am triggering an async refresh of the inbox (after the record is saved) by calling a javascript function (via ModalPopupExtender OnOkScript value) that detects the presence of a hidden button on the main form and firing it's click event which is handled as an asp:AsyncPostbackTrigger for the main web forms update panel. Everything works as designed, but from time to time after the remote page triggered refresh occurs the next timer refresh (Tick event) or other user initiated event (e.g. gridview row select, sort) will hang and result in an "Sys.WebForms.PageRequestManager TimeoutException: The Server request timed out."error. I am not sure if the remote page triggered refresh is confusing the AspTimer somehow or it is causing a collision of some sorts but any thoughts on the matter would be much appreciated.

Further details/update: Once I get the "Sys.WebForms.PageRequestManagerTimeoutException" error, I can consistentely get it to occur by clicking a button that triggers an async postback. It's as if the session has lost it's connection (note that this happens regardless if I am running against my local development machine (XP/IIS51) or our test server (2003/IIS6)). The very weird thing that is befuddling me is that if I use fiddler to watch the traffic to see what is going on it (the connection) will be magically restored and everything works fine again. There are no server side errors being thrown and JavaScript console in (NS/FireFox) does not show anything that would point me to a resolution.


Eureka!!! I figured out the problem. I have JavaScript methods that are called by my child forms when a user is clicking the "Close/Cancel" button that verify there are no unsaved changes before closing otherwise user is prompted to verify that they want to discard changes or not. If they confirmed that they wanted to close the web form I was simply calling window.close() but was not returning any value from the function which I think was a problem because the Close/Cancel button is located within the update panel (because the image changes depending on the scope of the form (e.g. new or view)) and thus despite closing the window I think the AJAX event lifecycle was being initiated but terminated abnormally because of the form closing. I added a "return false;" in my finally clause for all the functions that are used in the closing of a child web form and lo and behold my parent form no longer breaks (see example function below - added statement is bolded). I hope this solution also works for anyone else having a similar problem:

// Function Name: CloseVisitLog
// Function Purpose: Close the visit log form.
// Author: Michael Jensen
function CloseVisitLog(scope)
{
// put function within try-catch-finally block
try
{
// debug statement - set debug = true to view
if (debug) alert(">>Entered JavaScript:CloseVisitLog");

// declare local variables
var unsavedChanges = GetUnsavedChangesFlag();

if(scope == "new")
{
// make sure the user really wants to cancel
if (confirm("Are you sure you want to cancel creation of this visit log entry?"))
{
// close the window
window.close();
}
else
{
return false;
}
}
else if(scope == "view")
{
// if there are unsaved changes make sure the user really
// wants to close
if(unsavedChanges == "true")
{
if (confirm("There are unsaved changes, are you sure you want to close?"))
{
// close the window
window.close();
}
else
{
return false;
}
}
else
{
// close the window
window.close();
}
}
}
catch(ex)
{
var msg = "JavaScript:CloseVisitLog failed. ";
alert(msg + ex.messsage);
}
finally
{
// debug statement = set debug = true to view
if (debug) alert("<<Exiting JavaScript:CloseVisitLog");
// return false to prevent postback when window is closing
// otherwise parent form AJAX will break
return false;
}
}

UpdateProgress: how to implement different ones?

hi all. i started exploring the march ctp of atlas today, and i must say i'm really impressed (completely new to ajax/atlas). one thing i can't find out for myself tho...

when using an updateprogress control, is it possible to have multiple, and bind each one to a different callback?
i want to implement kind of a thing like pageflakes.com has; different loading indicators for different parts of the page... the problem is that no matter what i do, if i have more then one updateprogress, they all seem to respond to *any* callback, so i'm seeing multiple progress indicators with no matter which callback i do to my code-behind...

i hope i'm making myself sufficiently clear with this issue :)

in any case, thanks in advance for reading this far!

Yes, currently the UpdateProgress is 'bound' to the PageRequestManager and therefore listens to the async call, regardless of what control is making the call. This is something we are looking into ..


Sorry to duplicate posts, but I made comment of similiar nature in 'performance issues' post:

My controls are flashing on update panels. they turn 'grey' then are filled.

Also - the first callbacks are slower - which gives a pause to the user. This is troublesome. I have a page with 5 update panels. I'd like to have 5 different progress indicators, but all 5 fire at once.

I hope that is fixed.

Most of my use of update panels is used with dropdownlists, and selection of checkbox, etc... where in the past I would have had to postback to have a change. It's super fast locally of course, but when I move it to the server - it's too slow. This will be a problem for others as well, especially with dial up.

I think the development team needs to really investigate ways to let the user know there is activity - a good start would be only firing a progress indicator if it is in the updatepanel being called.

Also - it would help if a setting was available on the progress indicator where it would only show a message if the callback takes 'x' amount of time. This way, if you are on modem, you would get a indicator on a slow connection - however, if you are a on the LAN, there is no need to flash some 'processing' message up if the call only takes 1 second.

I hope this type of discussion is going on when examing solutions.

Thanks


oh ok, thanks a lot for the reply!
Thank god! Hope it'll be released soon.

UpdateProgress: Hide Page During Asynchronous Postbacks

I did a quick search, but I wasn't able to turn anything up. While an asynchronous postback is in progress, I'd like to hide the primary contents of the page and displayonly the contents of UpdateProgress. After the processing has completed, the controls should be made viewable again.

Is this possible?

Thank you,

--
Sean

Just in case anybody else comes across this, I got it to work by writing some custom JavaScript to hide a predetermined div. That way, when the UpdateProgress control is displayed, the screen is otherwise blank.

UpdateProgress.FindControl() does not work in beta 2

We have upgraded to beta 2 and the following code (which worked under beta 1) does not work.

The FindControl() method is returning null and the UpdateProgress.Controls.Count property is showing as 0.

Is this a problem in beta 2? Can anyone help with a solution?

<asp:UpdateProgressID="atlasProgress"runat="server">

<ProgressTemplate><asp:LabelID="messageLabel"runat="server"Text="Original Message"></asp:Label></ProgressTemplate></asp:UpdateProgress>

Label updateLabel = (Label)this.atlasProgress.FindControl("messageLabel");if (!(updateLabel ==null))

{

updateLabel.Text = "New Message";

}

I tested your codes and found the same problems as yours.asp:UpdateProgress.FindControl can not work in Ajax Beta 2.Maybe this is caused by Ajax Beta 2 framework.

Here are some explanations from ASP.NET Team for your reference.

Summary:

Due to a known issue with ASP.NET AJAX Beta 1, you may find that Extender controls no longer work with templated controls such as GridView or FormView. This issue will be addressed in the next release of ASP.NET AJAX.

Background:

The ScriptManager component on your ASPX page is responsible for rendering out the client script (JavaScript) that creates the client side components. The ScriptManager walks the list of components that need these hookups during it's PreRender phase of the page lifecycle. Unfortunately, templated controls often create their inner control heirarchies during PreRender as well. Therefore, since the ScriptManager appears earlier in the page than the templated control, the extenders have not been created yet, and the hookups don't happen.

Workaround:

Fortuantely, for the common case, there is a simple workaround. You simply need to force control generation earlier in the page lifecycle. The simplest way to do this is to call DataBind method or Controls property from the Page_Load.

protected void Page_Load(object sender, EventArgs e)

{

GridView1.DataBind(); // for databound controls

object o = Login1.Controls; // for templated controls

}

Caveat:

This doesn't work for templated controls that make changes to their tree, such as a GridView with an EditItemTemplate in it. If you have that scenario, unfortunately, you'll need to wait for the next release of ASP.NET AJAX Beta 1 to enable it.

Wish the above can help you.


Hi I'm having the same problem with the AjaxControlToolkit

Dim temp_lkExportedCSV As HyperLink = CType(UpdateProgress1.FindControl("lkExportedCSV"), HyperLink)
Dim temp_lblPercent As Label = CType(UpdateProgress1.FindControl("lblPercent"), Label)
Dim temp_lblStatus As Label = CType(UpdateProgress1.FindControl("lblStatus"), Label)

temp_lkExportedCSV.Enabled = False | And here I get an exception, because no control was found.


And I called the Controls method in the page load just like it was explained bu tit still didn't work.

Dim o As Object = Me.UpdateProgress1.Controls

Am I doing something wrong?


Maybe it's the nature of the UpdateProgress that's looks invisible until the associated UpdatePanel is updating.


This is a known issue with the UpdateProgress control. It gets added very late in the page's lifecycle. Move your code to the Page_PreRenderComplete event or Page_Unload event. Page_Load is too early.

UpdateProgress...animated GIF just stops...any ideas?

Since this post (http://forums.asp.net/thread/1469416.aspx) shows as resolved, I've decided to open a new post since I am having a problem with it. My animated GIF just stops. Has anyone ever had this issue? Ever been resolved?

Thanks!

Hi brenda

What do you mean by stops, does it not animate or does is not display at all? Did you try doing this?

<atlas:UpdateProgress ID="progress1" runat="server">
<ProgressTemplate>
<div class="progress">
<img src="http://pics.10026.com/?src=indicator.gif" />
Please Wait...
</div>
</ProgressTemplate>
</atlas:UpdateProgress>

Well this really works if you have your indicator.gif to be animated. Try this out and tell me if what I've understood from your problem is correct.

Thanks


This is my code I have so far, but the animated GIF just freezes. Is this inevitable because the page is rendering?

<

divstyle="float: right; color: #6870A4; font-family: Verdana, Tahoma, Arial; font-size: 11px;">
<asp:UpdateProgressID="UpdateProgress1"runat="server"DynamicLayout="true"DisplayAfter="0">
<ProgressTemplate>
<table>
<tr>
<td>
Loading Property -- Please Wait </td><td>
<imgstyle="padding-right: 10px;"src="../../images/ajax-loader.gif"alt="loading"/></td>
</tr>
</table>
</ProgressTemplate>
</asp:UpdateProgress>
</div>
If your code is causing the page to load, the .gif will stop animating. The UpdateProgess control is designed to be used in parallel with an UpdatePanel. In this scenario the page updates without the page actually loading.

updates from another thread

Hi, I'm trying to get a label control to update with dynamic information when a timer does its tick event.

I can get it to update with information hard-coded into the tick event, but i can't seem to get any data from a global variable or other shared resource.

Here's what i have so far-

using System;using System.Data;using System.Configuration;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using System.Threading;public partialclass _Default : System.Web.UI.Page {string temp;protected void Page_Load(object sender, EventArgs e) { }protected void Timer1_Tick(object sender, EventArgs e) { Label1.Text ="Tick at " + DateTime.Now.ToString()+"<br />";if (temp !=null) Label1.Text +="register at-"+temp; }protected void Button1_Click(object sender, EventArgs e) { Thread a =new Thread(Foo); a.Start(); }protected void Foo() {while (true) { Thread.Sleep(100); temp = DateTime.Now.Day.ToString(); } }}

(that's actually a +"<br />" at the end of the first line on the tick event)

and the markup-

<%@dotnet.itags.org. Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server" /> <div> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" /> </Triggers> </asp:UpdatePanel> </div> <asp:Timer ID="Timer1" runat="server" Interval="500" OnTick="Timer1_Tick"> </asp:Timer> <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /> </form> </body></html>
the 'register at" text never fires. I've tried using Session and Cache variables in place of a global string but no luck.

I am not sure how it is not working when puting it in Session/Cache, would you mind posting the code?


Here's the code using session-

using System;using System.Data;using System.Configuration;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using System.Threading;public partialclass _Default : System.Web.UI.Page {protected void Page_Load(object sender, EventArgs e) {if (!IsPostBack) Session["Store"] =null; }protected void Timer1_Tick(object sender, EventArgs e) { Label1.Text ="Tick at " + DateTime.Now.ToString()+"<br />";if (Session["Store"] !=null) Label1.Text +="register at-" + Session["Store"].ToString(); }protected void Button1_Click(object sender, EventArgs e) { Thread a =new Thread(Foo); a.Start(); }protected void Foo() {while (true) { Thread.Sleep(100); Session["Store"] = DateTime.Now.ToString(); } }}

It is not possible to access the session/request/response/cache from an different thread, also creating thread/using threadpool is not an good practise.


How should I update the label control then?

Or if using another thread is not good practice, i don't see how i'm going to be able to get the button postback to finish so i can update the label cleint side from the server during a (partial) postback


I am still not clear about your requirment, anyway here is the code snippet which will allow you to access the session from a different thread:

protected void Button1_Click(object sender, EventArgs e){ ThreadPool.QueueUserWorkItem(new WaitCallback(foo), Session);}private void foo(object state){ HttpSessionState session = (HttpSessionState)state; session["Store"] = DateTime.Now.ToString();}

Initial tests with this method provide the functionality I was after. I'll try to implament it today and let you know how it goes.


Indeed this seems to work well. I have 2 follow up questions relating to it though-

1. I went ahead and passed the session variable to other functions I use by reference...I'm guessing this is ok?

eg-

protected void Button1_Click(object sender, EventArgs e) { ThreadPool.QueueUserWorkItem(new WaitCallback(foo), Session); }private void foo(object state) { HttpSessionState session = (HttpSessionState)state; Thread.Sleep(100); session["Store"] = DateTime.Now.ToString(); Thread.Sleep(1000); foo2(ref session); }private void foo2(ref HttpSessionState session) { session["Store"] = DateTime.Now.ToString(); }

2. I notcied the application context still stays around after the browser is closed(presumably waiting for the thread to end?) should I manually be stopping the proccess somehow?


1. Yes you can pass it from the worker thread method.
2. The Thread returns to threadpool as soon as the foo2 method completes, no do not have to do anything.

Since it solved your problem, dont forget to mark it as answer.


Let's take another stab at this. You didn't really state the object of what you were trying to achieve. Why are you trying to use the variable temp? And if it truly is a shared variable, why didn't you just make it static? A Session variable certainly isn't global to the application. There's got to be a reason you're doing this and perhaps there is a much better approach.


The end result alows me to provided feekback to the cleint about a job currently being ran on the server (in psudo-real time). The timer updates the label on the client but it needs to be able to read from a variable (or somthing) that the job running on the server can write to. The session variable only needs to be global to the session (mutliple people could be using this at a time).

If there is another way to do this without using the cache or session I'd prefer too, but I havn't seen a way to do this yet...


Well there are certainly more expensive techniques such as using a Windows Service to host the job and querying it. Or using a DB entry to write the job status and querying it with a web service.

However you might be interested in this person's approach. He used a Cache object, but there is no reason it couldn't be Session (but Cache can be used if a unique identifier is set for a collection of jobs). The main difference is that his whole task is in this object, and it's public properties can be used to get it's status.

http://www.eggheadcafe.com/articles/20051223.asp


Use the Cache/ Store the Jobs status in DB as muliple user will be able to see the same result. BTW for one User you cannot use the session for storing the long running task status as the session access is always sequential.


I did try using the cache and i wasn't abe to get it to work ( see the first post). Essesntially the source looks the same as the session example except you use cache['whatever'] instead of session["whatever"].

I was under the impression that the session[] object was unique for each 'cleint session' that is, each cleint request would have it's own session object to work with. If this is the case why can't i use it for multiple users

@.wrayx1- I wanted to stay away from using a service althogh I have read some thing about how to get them to work, i think it overcompliactes the simple job I'm trying to do.