I have set auto complete text box in asp.net with c#. But I am getting slowness while binding huge volume of records (say 2000 or so) from the Database. If it is retrieving huge amount of record(say atleast 20k) then it doesn't work either. The call is done to a web method and values are returned to list from a data set.
What I have tried:
source code:
<pre> <script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.8.0.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.22/jquery-ui.js"></script>
<link rel="Stylesheet" href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.10/themes/redmond/jquery-ui.css" />
$(document).ready(function () {
$("#txtSearch").autocomplete({
source: function (request, response) {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "Test.aspx/GetData",
data: "{'DName':'" + document.getElementById('txtSearch').value + "'}",
dataType: "json",
success: function (data) {
response(data.d);
},
error: function (result) {
alert("Error......");
}
});
}
});
});
server side:
string strInstList = string.Empty;
List<string> result = new List<string>();
foreach (DataRow dr in DStEST.Tables[0].Rows)
{
result.Add(dr["CorporateID"].ToString());
}
return result;