Data validataion

G

Guest

I have few textboxes in the Form which users need to enter numeric values in
it. How can i perform validation on Button Click event which makes sure that
the data entered is numeric only not any text.

Thanks

Manny
 
R

Rad

I have few textboxes in the Form which users need to enter numeric values in
it. How can i perform validation on Button Click event which makes sure that
the data entered is numeric only not any text.

Thanks

Manny

What you need is several Compare Validators (For each text box).For
each validator set its ControlToValidate property to a text box, its
operator property to DataTypeCheck and the type property to Integer
(Or Double)
 
H

Hans Kesting

I have few textboxes in the Form which users need to enter numeric values in
it. How can i perform validation on Button Click event which makes sure that
the data entered is numeric only not any text.

Thanks

Manny

What you need is several Compare Validators (For each text box).For
each validator set its ControlToValidate property to a text box, its
operator property to DataTypeCheck and the type property to Integer
(Or Double)[/QUOTE]

.... and wrap the "Button_Click code" in a Page.Isvalid test.

in C#:

private void Button1_Click(object sender, System.EventArgs e)
{
if (Page.IsValid)
{
// process the page
}
}



Hans Kesting
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top