ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 利用模态DIV结合UpdateProgress防止页面重复提交

利用模态DIV结合UpdateProgress防止页面重复提交

原创 Linux操作系统 作者:iDotNetSpace 时间:2009-10-19 13:56:50 0 删除 编辑

页面在提交的时候可能因为服务器处理慢而导致用户多次重复的点击某个按钮,因此我们需要防止用户这么做,常见的方法是在客户端把该按钮 disable掉,但页面处理完或出现错误的时候又需要恢复按钮的状态,这样操作起来往往比较复杂,在atlas页面中,我们可以利用模态DIV和 UpdateProgress来实现同样的效果,实现起来也比较简单 。看下面的页面


<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--> 1<html xmlns="http://www.w3.org/1999/xhtml">
 2<head runat="server">
 3    <title>无标题页title>
 4    <style type="text/css">
 5    #modalDiv
 6    {
 7        position: absolute;
 8        top: 0%;
 9        left: 0%;
10        width: 100%;
11        height: 100%;
12        z-index:1001;
13        background-color: black;
14        opacity:.60;
15        filter: alpha(opacity=10);
16    }

17    style>
18head>
19<body>
20    <form id="form1" runat="server">
21        <asp:ScriptManager ID="ScriptManager1" runat="server">
22        asp:ScriptManager>
23        <asp:UpdateProgress ID="UpdateProgress1" runat="server" DisplayAfter="0">
24            <ProgressTemplate>
25                <div id="modalDiv">
26                div>
27            ProgressTemplate>
28        asp:UpdateProgress>
29        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
30            <ContentTemplate>
31                <asp:Button ID="Submit" runat="server"
32                    OnClick="Submit_Click" Text="Submit" />
33            ContentTemplate>
34        asp:UpdatePanel>
35    form>
36body>
37html> 
38

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/12639172/viewspace-616851/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-01-04

  • 博文量
    2376
  • 访问量
    5766495