Results 1 to 4 of 4

Thread: Validate textbox to be alpha only

  1. #1

    Thread Starter
    Fanatic Member staticbob's Avatar
    Join Date
    Jan 2005
    Location
    Manchestershire, UK Cabbage: I do
    Posts
    619

    Validate textbox to be alpha only

    Guys,

    How can I force a textbox on an asp.net page to contain alpha and num chars only ? ie - No symbols.

    When the users hit a button I am adding a record to my SQL dbase and I need to ensure they are not using symbols in certain fields.

    Thanks
    Bob

  2. #2
    Hyperactive Member GlenW's Avatar
    Join Date
    Nov 2001
    Location
    Gateshead, England
    Posts
    479

    Re: Validate textbox to be alpha only

    Use a RegularExpressionValidator control.

  3. #3

    Thread Starter
    Fanatic Member staticbob's Avatar
    Join Date
    Jan 2005
    Location
    Manchestershire, UK Cabbage: I do
    Posts
    619

    Re: Validate textbox to be alpha only

    Thanks Glen, but what would the validation expression be ?

    Thanks
    Bob

  4. #4
    Hyperactive Member GlenW's Avatar
    Join Date
    Nov 2001
    Location
    Gateshead, England
    Posts
    479

    Re: Validate textbox to be alpha only

    This may not be spot on but it shouldn't be far away.

    [^a-zA-Z0-9]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width