Hi naveed,
Refer the below sample.
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" />
<script type="text/javascript">
$(function () {
$('[id*=txtSearch]').keypress(function (event) {
if (event.which == '13') {
event.preventDefault();
}
});
$('[id*=txtSearch]').keyup(function (event) {
if ($(this).val().length >= 3) {
$('[id*=lbtnSearch]').attr('disabled', 'disabled');
$('[id*=lbtnSearch]').removeAttr('href');
}
else {
$('[id*=lbtnSearch]').removeAttr('disabled');
}
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input name="txtSearch" type="text" id="txtSearch" />
<a id="lbtnSearch" class="btn btn-primary" class="" href="javascript:__doPostBack('lbtnSearch','')">
<span class="glyphicon glyphicon-search"></span></a>
</div>
</form>
</body>
</html>
Demo
You can replace the html control with ASP controls.
<asp:TextBox ID="txtSearch" runat="server" />
<asp:LinkButton ID="lbtnSearch" runat="server" class="" CssClass="btn btn-primary"
CausesValidation="true" ValidationGroup="v1">
<span class="glyphicon glyphicon-search"></span>
</asp:LinkButton>