RadMaskedTextbox - Search via Codebehind on KeyPress

4 posts, 0 answers
  1. Jeff
    Jeff avatar
    25 posts
    Member since:
    Feb 2011

    Posted 29 Dec 2011 Link to this post

    I have a situation where we want to use a search method that is already in place for post backs on certain pages, however, they want to use the same method but use it for onkeypress to search while the user is entering to return matches, etc.  obviously the onkeypress is client-side and my method is in a class which I can call from the code behind which is server side. Suggestions on this?
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 29 Dec 2011 Link to this post

    Hello,

    I suppose you want to attach OnKeyPress event via server side. Here is the sample code.
    C#:
    txtbox.Attributes.Add("OnKeyPress", "GetKeyPress()");
    Note: Handle GetKeyPress() from client side.

    -Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jeff
    Jeff avatar
    25 posts
    Member since:
    Feb 2011

    Posted 30 Dec 2011 Link to this post

    Actually I want to fire an async call to the codebehind.  I have the search method available there not on the client side.
  5. Jeff
    Jeff avatar
    25 posts
    Member since:
    Feb 2011

    Posted 30 Dec 2011 Link to this post

    Nevermind, I am using OnTextChanged with AutoPostBack set true so that when the control loses focus it fires the method I want. It appears we do not need autocomplete on this particular form.  Though I would be interested in knowing if it can be done.
Back to Top