using update panel do sync job , update UI control async
来源:互联网 发布:淘宝衣服模特 编辑:程序博客网 时间:2024/05/29 14:46
Scenario :
1.click submit disable button ,start job
2.once job done , enable submit button
Here is the implementation :
Aspx page Code :
Step 1: add update panel and script manager
<form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager" runat="server"> </asp:ScriptManager> <asp:UpdatePanel ID="AsynUpdatePanel" runat="server" UpdateMode="Conditional"> <ContentTemplate> <!--<span class="code-comment"> Here on click is a long running operation e.g. 30 secs --></span> <asp:Button ID="Submit" runat="server" OnClick="Submit_Click" Text="Submit" /> </ContentTemplate> </asp:UpdatePanel> </form>
Step 2: add javascript
<script type="text/javascript"> Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(startRequest);Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequest); function startRequest(sender, e) {document.getElementById("<%=Submit.ClientID%>").disabled = true; }function endRequest(sender, e) { document.getElementById("<%=Submit.ClientID%>").disabled = false; } </script>
Step 3:
Code behind :
//Simulate a long time task protected void Submit_Click(object sender, EventArgs e) { Thread.Sleep(2000); }
0 0
- using update panel do sync job , update UI control async
- update panel--AJax
- Update Data Using Transactions
- update
- update
- update
- update
- update
- update
- update
- update
- update
- update
- update
- update
- Update()
- Update
- update
- Study notes: Floating point
- Spring中AOP基于XML的两种配置方法
- Windows 窗体入门(VS2010 )
- 为我们的java软件加上系统热键功能。
- VMware虚拟机及Centos 基础操作
- using update panel do sync job , update UI control async
- 工具接口标准(TIS)可执行链接格式(ELF)规范-卷I-附录A-保留字(Reserved Names)
- js加密大全(防止客户端查看自己的js文件)
- Java中的泛型之十诫
- IOS开发编程中的问题小结(二)
- linux 下安装ab
- Android事件分发机制
- API实现自动处理物料搬运单
- poj 3923