Skip to content

Infragistics Community Forum / Web / Ultimate UI for ASP.NET Web Forms / how do I cancel the TextChanged event

how do I cancel the TextChanged event

New Discussion
Mason Woods
Mason Woods asked on Sep 25, 2009 9:42 PM

function txtMsg_TextChanged(sender, eventargs){

if (x==1)
    oEvent.cancel=true;   <——There is no oEvent parm, what do I do?????

 

}

Sign In to post a reply

Replies

  • 0
    [Infragistics] Murtaza Abdeali
    [Infragistics] Murtaza Abdeali answered on Sep 25, 2009 8:17 PM

    You can use the ValueChanging event to cancel a value change by the user, or if you want to cancel a key stroke then handle the KeyDown event and cancel that. Here is an example.

    function

    lblMsg_ValueChanging(sender, eventargs) {

    eventargs.set_cancel(true);

    }

    function lblMsg_keyDown(sender, eventargs) {

    eventargs.set_cancel(true);

    }

    So, if you want to cancel input after the user is done entering the value then use ValueChanging & if you want to validate each key stroke then use KeyDown.

    HTH,

    Taz.

     

     

    • 0
      Mason Woods
      Mason Woods answered on Sep 25, 2009 8:54 PM

      eventargs.set_cancel(true);

       

      t5his does not work….neither in the TextChanged or valuechanged event….

       

       

       

       

       

       

       

       

       

      function

       

       

      lblMsg_ValueChanged(sender, eventargs){

      var

       

      xid=sender._id;

      var

       

      txt = $find(xid);

      var

       

      ct= txt.get_text();

      var

       

      abbrv = document.getElementById(ctl + "_lblAbbrv");

      var

       

      atxt=abbrv.innerHTML + ': ';

      if

       

      (ct.startsWith(atxt))

       

       

      var f=6;

      else

       

       

      eventargs.set_cancel(true);

      so if a person has text in the WebTextEditor "Mase: Welcome to my club" and tries to change the text by selecting and delting "Mase:" I want to cancel so that this Msg Identifier can not be deleted???

       

      I also need to let the use know upon each text change, either by typing one char or deleting a whole line, how many chars long the text is.  I use the TexChanged even for this

      it would be best if I could cancel the text_changed event…

      please feel free to call if you need more explanaton…thanks for your help

      • 0
        [Infragistics] Murtaza Abdeali
        [Infragistics] Murtaza Abdeali answered on Sep 25, 2009 9:42 PM

        You are using ValueChanged notice "ed" at the end.. Use ValueChaning event, notice "ing" at the end. This is the event that you can cancel.

        For each key stroke validation, you can use the KeyDown event.

        -Taz.

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Mason Woods
Favorites
0
Replies
3
Created On
Sep 25, 2009
Last Post
16 years, 10 months ago

Suggested Discussions

Created by

Created on

Sep 25, 2009 9:42 PM

Last activity on

Feb 16, 2026 8:39 PM