
28/08/2009, 03:26
|
 | | | Fecha de Ingreso: agosto-2008 Ubicación: En internet
Mensajes: 2.511
Antigüedad: 16 años, 5 meses Puntos: 188 | |
Respuesta: Validar textbox numérico en c# para webforms Bueno, autocriticándome he conseguido hacer esto:
protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
{
double numero;
Boolean EsNumero = double.TryParse(TextBox3.Text, out numero);
if (!EsNumero)
{
TextBox3.Text = "Error";
args.IsValid = false;
}
else { }
}
Quizás sea esta mejor opción que recorrer el texto completo, al menos en cuanto a la cantidad de operaciones a realizar. |