This is a migrated thread and some comments may be shown as answers.
RadMaskedTextbox - Search via Codebehind on KeyPress
3 Answers 26 Views
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 29 Dec 2011, 04:44 PM
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?

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 30 Dec 2011, 05:35 AM
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.
0
Jeff
Top achievements
Rank 1
answered on 30 Dec 2011, 05:22 PM
Actually I want to fire an async call to the codebehind.  I have the search method available there not on the client side.
0
Jeff
Top achievements
Rank 1
answered on 30 Dec 2011, 05:45 PM
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.
Tags
Input
Asked by
Jeff
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Jeff
Top achievements
Rank 1
Share this question
or