尝试使用$('#btnEnter').prop('disabled', true);
,但不会禁用我的按钮。同样,当我单击“后退”按钮时,页面也会崩溃。
jquery
<script>
function gray() {
$('#btnEnter').prop('disabled', true);
}
</script>
具有要禁用的按钮的子页面
<asp:Button ID="btnEnter" CssClass="btn btn-light btn-md btn-block" runat="server" Text="Enter Value" OnClick="btnEnter_Click"/>
代码隐藏子页面
public partial class Institution1Submit : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
checkConnection();
}
//check if connected before going submit page
public async void checkConnection()
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "n", "gray();", true);
}}
返回按钮
protected void btnBack_Click(object sender, EventArgs e)
{
Response.Redirect("../Nodes.aspx");
}