8
Answers

Display search record in GridVIew

Davin Martyn

Davin Martyn

9y
1.6k
1

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 ?
 

Answers (8)
0
Davin Martyn

Davin Martyn

NA 7.5k 3m 9y
 

<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("<tr><td>" + r.d[i].Loan_id +

"</td><td>" + r.d[i].Name +

"</td><td>" + r.d[i].Name + "</td></tr>");

}

}

});

});

});

$(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

});

});





Please check my code my record in display textbox but when we click on button gridview not display please check ? 



0
Davin Martyn

Davin Martyn

NA 7.5k 3m 9y
Please check my code :
0
Davin Martyn

Davin Martyn

NA 7.5k 3m 9y
Please check my code :
0
Rajeesh Menoth

Rajeesh Menoth

66 27.1k 2.7m 9y
Hi,
Check the grid bind section..
0
Davin Martyn

Davin Martyn

NA 7.5k 3m 9y
I have searched record from textbox and after click my gridview not display please help?
0
Rajeesh Menoth

Rajeesh Menoth

66 27.1k 2.7m 9y
Hi,
 
Ref the following article :
 
1) http://jqueryasp.net/search-gridview-records-on-textbox-keypress-using-jquery-in-asp-net/ 
 
2) http://www.aspdotnet-suresh.com/2011/12/search-records-in-gridview-and.html 
 
0
Shridhar Sharma

Shridhar Sharma

Tech Writer 5.8k 2.9m 9y
Hi Davin,
Please follow this url for search values from database autocomplete textbox
 
http://www.c-sharpcorner.com/code/1573/search-data-from-database-using-auto-complete-functionality.aspx
 
After getting that value you can bind it in GridView.
 
Hope this will help you.
 
 
0
Raja T

Raja T

331 5.4k 112.6k 9y
Hi, please check out...

http://www.aspsnippets.com/Articles/Search-GridView-records-data-on-TextBox-KeyPress-using-jQuery-in-ASPNet.aspx

http://www.encodedna.com/gridview/tutorial/search-records-in-gridview-using-filterparameters.htm