Hi,
yes, this is a nice idea. Check the following example:
<%@. 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) { if (Page.IsPostBack) { lblUpdate.Text = DateTime.Now.ToString(); } } protected void btnUpdate_Click(object sender, EventArgs e) { System.Threading.Thread.Sleep(5000); }</script><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title> <style type="text/css"> #UpdatePanel1 { height: 200px; width: 400px; border: solid 1px #ccc; } </style></head><body> <form id="form1" runat="server"> <atlas:ScriptManager ID="scriptManager" runat="server" EnablePartialRendering="true"></atlas:ScriptManager> <div> <atlas:UpdatePanel ID="UpdatePanel1" runat="server"> <Triggers> <atlas:ControlEventTrigger ControlID="btnUpdate" EventName="Click" /> </Triggers> <ContentTemplate> <asp:Label ID="lblUpdate" runat="server"></asp:Label> </ContentTemplate> </atlas:UpdatePanel> </div> <div> <asp:Button ID="btnUpdate" runat="server" Text="Update" OnClick="btnUpdate_Click" /> </div> <script type="text/javascript"><!-- Sys.Application.load.add(application_load); function application_load() { $object('_PageRequestManager').propertyChanged.add(onPropertyChanged); } function onPropertyChanged(sender, e) { if(e.get_propertyName() == 'inPostBack') { if($object('_PageRequestManager').get_inPostBack() == true) { $('UpdatePanel1').style.cursor = 'wait'; } else { $('UpdatePanel1').style.cursor = 'default'; } } } //--> </script> </form></body></html>
And in fact in Atlas 1.0 we'll have some events that are much easier to use: PageRequestManager will have a beginRequest and endRequest client-side event that you can use for this.
Thanks,
Eilon
Hi,
this is good news :)
Has this been implemented yet? If so how do I get it to work?
I was kinda hoping for onUpdating or something on the panel.
I'm using Ajax 1.0 Beta 2
Thought I'd solved my own problem with this script:
<script type="text/javascript" language="javascript"> Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler); Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler) function BeginRequestHandler(sender, args) { document.body.style.cursor="wait"; } function EndRequestHandler(sender, args) { document.body.style.cursor="default"; } </script>
But looks likedocument.body.style.cursoronly works outside of the webparts which is no good. I'll keep working on it.
No comments:
Post a Comment