Asp.net 禁用aspx页面中的按钮

Asp.net 禁用aspx页面中的按钮,asp.net,Asp.net,我正在尝试禁用aspx表单中的按钮。这项工作: btnSave.Attributes.Add( "onclick", "this.disabled=true;this.value='Saving...';needToConfirm=false;" + ClientScript.GetPostBackEventReference(btnSave, "").ToString()); 但是表单上有两个按钮,我想禁用这两个按钮。这不起作用: btnSave.Attributes

我正在尝试禁用aspx表单中的按钮。这项工作:

btnSave.Attributes.Add(
    "onclick",
    "this.disabled=true;this.value='Saving...';needToConfirm=false;" +
    ClientScript.GetPostBackEventReference(btnSave, "").ToString());
但是表单上有两个按钮,我想禁用这两个按钮。这不起作用:

btnSave.Attributes.Add(
    "onclick",
    "this.disabled=true;this.value='Saving...';document.getElementById(<%=btnDelete.ClientID %>).disableneedToConfirm=false;" +
    ClientScript.GetPostBackEventReference(btnSave, "").ToString());

在这里的btnsave代码中有对btnDelete的引用。。您可能应该将其更改为btnSave:


哎呀!失败的行应为:btnSave.Attributes.Addonclick,this.disabled=true;这个.value='Saving…';document.getElementById.disabled=true;needToConfirm=false;+ClientScript.GetPostBackEventReferencebtnSave、.ToString;当其中一个按钮被点击时,我试图禁用这两个按钮!
btnSave.Attributes.Add("onclick", "this.disabled=true;this.value='Saving...';document.getElementById(<%= btnDelete.ClientID %>).disableneedToConfirm=false;" + ClientScript.GetPostBackEventReference(btnSave, "").ToString());