Data validataion

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Manny Chohan

    Data validataion

    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
  • Rad

    #2
    Re: Data validataion

    On Wed, 15 Nov 2006 11:05:01 -0800, Manny Chohan
    <MannyChohan@di scussions.micro soft.comwrote:
    >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 ControlToValida te property to a text box, its
    operator property to DataTypeCheck and the type property to Integer
    (Or Double)

    Comment

    • Hans Kesting

      #3
      Re: Data validataion

      On Wed, 15 Nov 2006 11:05:01 -0800, Manny Chohan
      <MannyChohan@di scussions.micro soft.comwrote:
      >
      >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 ControlToValida te property to a text box, its
      operator property to DataTypeCheck and the type property to Integer
      (Or Double)
      .... and wrap the "Button_Cli ck code" in a Page.Isvalid test.

      in C#:

      private void Button1_Click(o bject sender, System.EventArg s e)
      {
      if (Page.IsValid)
      {
      // process the page
      }
      }



      Hans Kesting


      Comment

      Working...