This is a migrated thread and some comments may be shown as answers.

How to attach client event to textbox inside RadSearchBox?

2 Answers 168 Views
SearchBox
This is a migrated thread and some comments may be shown as answers.
Robin
Top achievements
Rank 2
Robin asked on 30 Jul 2013, 10:30 AM
Hi, 

Is there a way to attach client event to textbox inside RadSearchBox control?
I want to attach keypress event and check whether user press "Enter" key or not.

Thanks in advanced,
Robin


2 Answers, 1 is accepted

Sort by
0
Accepted
Plamen
Telerik team
answered on 02 Aug 2013, 06:22 AM
Hello Robin,

 
Thank you for contacting Telerik support.

One way to achieve such behavior is by using jQuery as in the code below:

<script type="text/javascript">
 
           function pageLoad() {
               var $ = $telerik.$;
               $(".rsbInput ").keypress(function (event) {
                   if (event.which == 13) {
                       alert("enter pressed");
                   }
               });
           }
 
       </script>


Hope this will be helpful. If you have further questions please don't hesitate to contact us again.

Regards,
Plamen
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Robin
Top achievements
Rank 2
answered on 02 Aug 2013, 08:24 AM
Thanks a lot, Plamen.
My problem is that when I press "Enter" key inside RadSearchBox, other button click event is if firing
and that's why I'm trying add event.preventDefault() for this textbox.
Now, my problem solved by using your provided code sample.

Thanks and best regards, 
Robin
Tags
SearchBox
Asked by
Robin
Top achievements
Rank 2
Answers by
Plamen
Telerik team
Robin
Top achievements
Rank 2
Share this question
or