How to disable a HTML Input in c#
-
Hi all, Tt's a HTML Input box like this.
and for some reason, I cannot use ASP.net textbox. However, I need to disable it when a button is clicked (I tried both AUTOPOSTBACK and non-AUTOPOSTBACK button) . I tried the followings in c# but none of these works.
Page.ClientScript.RegisterStartupScript(this.GetType(), "clientscript", "document.getElementById('testInput').readOnly = true;"); Page.ClientScript.RegisterStartupScript(this.GetType(), "clientscript", "document.getElementById('testInput').disable= true;");
Page.ClientScript.RegisterStartupScript(this.GetType(), "clientscript", "document.getElementById('testInput').disable= 'true';");
' Please advice, thanks!
-
Hi all, Tt's a HTML Input box like this.
and for some reason, I cannot use ASP.net textbox. However, I need to disable it when a button is clicked (I tried both AUTOPOSTBACK and non-AUTOPOSTBACK button) . I tried the followings in c# but none of these works.
Page.ClientScript.RegisterStartupScript(this.GetType(), "clientscript", "document.getElementById('testInput').readOnly = true;"); Page.ClientScript.RegisterStartupScript(this.GetType(), "clientscript", "document.getElementById('testInput').disable= true;");
Page.ClientScript.RegisterStartupScript(this.GetType(), "clientscript", "document.getElementById('testInput').disable= 'true';");
' Please advice, thanks!
The syntax should be "disabled" not "disable"
document.getElementById('testInput').disabled = true;
HTML DOM Input Text disabled Property[^] By the way, I think you should had posted this question to Web Development Discussion Boards[^] instead of "C / C++ / MFC"
Bryian Tan