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
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.
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.