Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 813727
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:24:26+00:00 2026-05-15T01:24:26+00:00

I have an asp:TextBox with asp:RegularExpressionValidator to validate if it’s a number. Obviously an

  • 0

I have an asp:TextBox with asp:RegularExpressionValidator to validate if it’s a number. Obviously an onchange event will be attached to this textbox while rendering. Also I add a change event at $(document).ready to make some calculation when the value is changed.

<asp:TextBox id="myText" runat="server" />
<asp:regularexpressionvalidator id="myRev" ControlToValidate="myText" runat="server">*</asp:regularexpressionvalidator>

$(document).ready(function(){
    $('[id$=myText]').bind('change',function(){
           //do something
    }).change();      //force the change event at the very beginning
});

My function will be executed later than the .net generated js because of the register time. But the asp.net js throws an error. I traced in the js:

   function ValidatorOnChange(event) {
       ...
   }

and found that all of event.fromElement,event.toElement,event.srcElement are null which causes the exception. Did I do something wrong? Any solutions? Thanks.

EDIT

It’s proved to be a MS bug, working fine in ASP.NET 4 vs2010.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T01:24:27+00:00Added an answer on May 15, 2026 at 1:24 am

    Including Pointy’s point (I crack myself up) about ID, you can re-write it like this:

    $(function(){
      $('#<%=myText.ClientID%>').change(function() {
        //stuff
      }).triggerHandler('change');
    });
    

    Without seeing exactly how your other event is attached, .triggerHandler() would be my best suggestion, as the event doesn’t bubble up for capture by the .Net handler.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have asp.net TextBox with ontextchanged event this is search text box in my
I have an asp:TextBox and I want to validate that the number of characters
I have an asp.net textbox and a MaskedEditExtender control attached to it. The textbox
I have: <asp:TextBox ID=Profile_EMail runat=server CssClass=form /> and <asp:RegularExpressionValidator ID=Validator_Profile_EMail runat=server ControlToValidate=Profile_EMail meta:resourcekey=Validator_Profile_EMail ValidationExpression=\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*>
I have an asp:TextBox associated to a jquery DatePicker. This input has a onTextChangedEvent
On one of my ASP.NET pages I have several asp:textbox fields. On this page
I have an asp.net regularexpressionvalidator that I need to match on a textbox. If
I have a asp.net textbox that uses a RegularExpressionValidator. If the regular expression fails,
I've got an ASP.NET page that includes an asp:TextBox with a RegularExpressionValidator attached, and
I'm trying to validate an ASP TextBox that can only have 1-2 digits (not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.