Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > How to Fire Validators on TextChange Event

Reply
Thread Tools

How to Fire Validators on TextChange Event

 
 
Keith H
Guest
Posts: n/a
 
      09-08-2004
I have a form with a text box and a button, and I've written my server-side
button click event handler to handle the events of the textbox's textchanged
event as well, and that works fine.

I also have validator controls on the form, and they only work when the
button is actually clicked; but the browser will submit the form to the
server when the user enters some text in the text box and presses the <enter>
key. I want the validators to fire off in both cases.

I've searched around the newsgroups and forums and tried the following based
on something I found that was very close to what I wanted (though there was
no follow-up post to indicate whether it worked or not). This isn't working
for me:

Dim strOnChange As String = "if (typeof(Page_ClientValidate) == 'function')
Page_ClientValidate(); " & Page.GetPostBackClientEvent(txtSlideNo, "")
txtSlideNo.Attributes.Add("onchange", "this.form.txtSlideNo.click();")

....even though I can view source and see the exact same javascript for the
onchange attribute of my text box that the onclick attribute of my button
has.

Can this be done in a relatively simple way? What am I missing?
 
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
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
TextBox TextChange Event sunilthk@gmail.com ASP .Net 0 06-25-2006 06:42 AM
asp:TextBox - TextChange Event (Enter Key Does Not Work) PD ASP .Net 5 09-02-2004 06:02 PM
How to raise TextChange event for textbox created at run-time. Anand Sagar ASP .Net 2 04-28-2004 02:06 PM
TextChange event does not always fire Duwayne ASP .Net 1 08-20-2003 09:18 PM



Advertisments