<script type = "text/javascript"> function DisableButton() { document.getElementById("< %Submit.ClientID %>").disabled = true; } window.onbeforeunload = DisableButton; </script>I want to "translate" this code into the Client Script built in code behind. But I get error on the
String csname2 = "ButtonClickScript"; Type cstype = this.GetType(); // Get a ClientScriptManager reference from the Page class. ClientScriptManager cs = Page.ClientScript; StringBuilder cstext2 = new StringBuilder(); cstext2.Append("<script type=\"text/javascript\"> function DisableButton() {"); cstext2.Append("document.getElementById("< %=Submit.ClientID %>").disabled = true};"; cstext2.Append("window.onbeforeunload = DisableButton;"); cstext2.Append("</script>");But I get syntax error on the line
cstext2.Append("document.getElementById('" + Submit.ClientID + "').disabled = true; }");