Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > client side validation with asp:TextBox ???

Reply
Thread Tools

client side validation with asp:TextBox ???

 
 
Christian Cambier
Guest
Posts: n/a
 
      07-14-2008
Hello,

I have a textbox in which I only want to display numbers when the
focus is set on the textbox and the user presses a key on the kb.
Easy with html-control <input id="htmlTxtVal2" type="text"
onkeypress="return NoNumbers(event)" and javascript (implement the
onkeypres event handler)

But how to implement it when using the asp:TextBox control ?
Seems to me that a validation control doesn't work 'cause validation
is only performed when the user clicks the send-button, and NOT when
the user is still entering the information in the textbox.

So, how?

thank you
Chris
 
Reply With Quote
 
 
 
 
Christian Cambier
Guest
Posts: n/a
 
      07-14-2008
On Jul 14, 5:58 pm, "Mark Rae [MVP]" <m...@markNOSPAMrae.net> wrote:
> "Christian Cambier" <christian.camb...@gmail.com> wrote in message
>
> news:9f33bc32-754f-41aa-b3f4-...
>
> > I have a textbox in which I only want to display numbers when the
> > focus is set on the textbox and the user presses a key on the kb.
> > Easy with html-control <input id="htmlTxtVal2" type="text"
> > onkeypress="return NoNumbers(event)" and javascript (implement the
> > onkeypres event handler)

>
> > But how to implement it when using the asp:TextBox control ?

>
> MyTextBox.Attributes.Add("onkeypress", "return NoNumbers(event);");
>
> --
> Mark Rae
> ASP.NET MVPhttp://www.markrae.net


thank you for the great tip!

Chris
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to execute client-side code _after_ client-side validation? Bogdan ASP .Net 2 06-09-2008 01:31 PM
Client side script after client side validation with asp.net 2.0 Boss302 ASP .Net 0 11-21-2006 08:43 AM
Using both server side validation and client side validation =?Utf-8?B?dmlkeWE=?= ASP .Net 1 06-02-2005 09:45 PM
ASP.NET Web Forms Validation Controls are Server-Side or Client-Side Validation? Matt ASP .Net 14 01-30-2004 09:15 AM
validation summary doesnt display when there's client-side validation Libs ASP .Net 0 06-25-2003 03:05 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57