3
Use this JS function in ASP.net:
function habilitado(){
var b = document.getElementById('<%= Label4.ClientID %>').value = "Habilitado";
}
I call it that in codebehind. The value of the label should be changed, but it doesn’t happen. Someone can help?
Note: I’ve tried using $(document).ready(function()
at first, and yet it doesn’t work.
ClientScript.RegisterClientScriptBlock(this.GetType(), "teste", "<script language=\"javascript\">habilitado();</script>");
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "teste", "<script type='text/javascript'>habilitado();</script>", true);
When you load the page in the browser, does the generated Javascript look like this? Have you checked if the first string (
'<%= Label4.ClientID %>'
) replaced by label ID?– Oralista de Sistemas