Hi,
I used the search textbox code which is in javascript. But I want that to be working on server side. The code works fine on client side but not on server side. Please see the code
<script type="text/javascript">
$(document).ready(function (e) {
$('#ctl00_topNavigation_txtSearch').bind('keypress', function (event) {
if (event.which == 13 || event.keyCode == 13) {
window.location.href = "search.aspx?tx=" + $(this).val();
return false;
} else {
var regex = new RegExp("^[.a-zA-Z0-9\b _ _%]+$");
var key = String.fromCharCode(!event.charCode ? event.which : event.charCode);
if (!regex.test(key)) {
event.preventDefault();
return false;
}
}
return true;
});
});
</script>
<asp:TextBox ID="txtSearch" runat="server" class="txtfld-search" ValidationGroup="valgrp" oncopy="return false" oncut="return false" onpaste="return false"></asp:TextBox>
This search box should not allow any special characters to be typed by the user. I tried it on client side, but it is not working for me on server side. Please help