protected void validatePedido(object sender, ServerValidateEventArgs args) { args.IsValid = false; if (args.Value.Trim().Length <= 0) { return; } TextBox txt_pedido = ((Control)sender).Parent.FindControl("txt_pedido") as TextBox; try { Entrada_liverpool o = new Entrada_liverpool() { Trafico = txt_trafico.Text.Trim(), Pedido = Convert.ToInt32(txt_pedido.Text.Trim()) }; EntradaCtrl.EntradaLiverpoolGetByUniqueKey(o); if (o.Id <= 0) { return; } } catch (Exception e) { ((MstCasc)this.Master).setError = e.Message; } args.IsValid = true; }