2010-03-25 56 views
1

我需要在以下情况下帮助: 论aspx页面保存按钮的点击,一些处理会发生。处理过程可以是10-15分钟。我想要禁用SAVE按钮,直到过程结束,一旦过程完成,应该启用SAVE按钮。 我尝试以下,但couldnot解决的问题: 1)客户端脚本: 我叫上按钮的客户CLIK Java脚本,并设置禁止属性永远true.How,不叫服务器端saveButton_Click事件,因为禁用客户端的按钮。 2)在服务器端的saveButton_Click方法中禁用: 在这种情况下,由于saveButton_Click的调用已经发生并且被请求发送到服务器,因此客户端在处理请求之前没有任何区别。禁止对同一按钮的点击ASP按钮,直到进程结束

请尽快帮助我。它非常紧急。

感谢 鲁帕

回答

0

你说:“1)客户端脚本:我叫上按钮的客户CLIK Java脚本,并设置禁止属性永远true.How,服务器端saveButton_Click事件不被调用,因为禁用客户端的按钮。“这意味着该按钮现在被禁用,并且不会处理对服务器端的调用,直到您重新启用该按钮。那它不符合你的要求吗?

0

使用在你按一下按钮System.Threading.Thread.Sleep(5000),并使其残疾人...

对于裁判Disable submit button

0

你可以使用一个虚拟的提交按钮:

<%@ Page Language="C#" AutoEventWireup="true" %> 
<script type="text/C#" runat="server"> 
    protected void BtnClick(object sender, EventArgs e) 
    { 
     System.Threading.Thread.Sleep(2000); 
     result.Text = DateTime.Now.ToLongTimeString(); 
    } 
</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></title> 
</head> 
<body> 
    <form id="form1" runat="server"> 
    <button type="button" onclick="this.disabled='disabled';document.getElementById('<%= btn.ClientID %>').click();">Start processing</button> 
    <asp:Button ID="btn" runat="server" OnClick="BtnClick" style="display:none;" /> 
    <asp:Label ID="result" runat="server" /> 
    </form> 
</body> 
</html> 
+0

@Darin PLZ帮我http://stackoverflow.com/questions/2507844/how-to-use-jquery-to-paginate -json数据 – 2010-03-25 11:58:58

0

你可以简单地通过这段代码来处理它。假设,这里是一个名为btnAdd的按钮。当你点击这个按钮时,它将被禁用,因为它执行了相应的代码。我的意思是回发它将被禁用。

if (!IsPostBack) 
    { 
    btnAdd.Attributes.Add("onclick", "this.disabled=true;" + GetPostBackEventReference(btnAdd).ToString()); 
    } 
0

集的OnClientClick和UseSubmitBehavior在你的按钮标记

OnClientClick="this.disabled = true; this.value = 'Submitting...';" UseSubmitBehavior="false"