I have one aspx page where I need to validate some fields, I made this validation on C# code, but there wasn't working.
So I tried put a simple code only to discover what was the problem, so I realized that didn't matter the code, if I run a ScriptManager.RegisterStartupScript or a ScriptManager.RegisterClientScriptBlock, my C# code doesn't work.
Here is an example:
protected void btnBuscar_Click(object sender, EventArgs e){
this.lblValidarEmpresa.Visible = false;
ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "script", "AplicarMascara();", false);
}
The function AplicarMascara() applies a data mask on a text field.
Do you know how solve this problem? Or any other way to apply this mask without use ScriptManager?
Thanks.
It looks like you're trying to execute javascript code when the button is pushed and things are getting complicated with the use of the updatepanel. Have you considered triggering "AplicarMascara" using the onclientclick property of btnBuscar? You didn't post your code for the button definition but here's a sample of what it should look like: