2010-03-25 123 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"