Hi,
I am working in Jquery and I want to search record through autocomplete textbox and after click on button all related record display in gridview please help how can do this ?
Hi,
I am working in Jquery and I want to search record through autocomplete textbox and after click on button all related record display in gridview please help how can do this ?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Davin MartynPosted Sep 24, 2015, 6:21 AM
<script type="text/javascript">
$(document).ready(function () {
$("#btnLoad").click(function () {
$.ajax({
type: "POST",
url: "Default.aspx/GetEmpNames",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (r) {
for (var i = 0; i < r.d.length; i++) {
$("#gvAuthors").append("" + r.d[i].Loan_id +
" + r.d[i].Name +
" + r.d[i].Name + " ");
"
"
}
}
});
});
});
$(function () {
$("[id$=txtSearch]").autocomplete({
source: function (request, response) {
$.ajax({
url: '<%=ResolveUrl("~/Default.aspx/GetEmpNames") %>',
data: "{ 'empName': '" + request.term + "'}",
dataType: "json",
type: "POST",
contentType: "application/json; charset=utf-8",
success: function (data) {
response($.map(data.d, function (item) {
return {
label: item.split('-')[0],
val: item.split('-')[1]
}
}))
},
error: function (response) {
alert(response.responseText);
},
failure: function (response) {
alert(response.responseText);
}
});
},
select: function (e, i) {
$("[id$=hfCustomerId]").val(i.item.val);
},
minLength: 1
});
});
Davin MartynPosted Sep 24, 2015, 6:19 AM