Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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>();

        //List<Corporate> result = new List<Corporate>();

        foreach (DataRow dr in DStEST.Tables[0].Rows)
        {
            result.Add(dr["CorporateID"].ToString());
        } 
return result;
Posted
Updated 18-Dec-17 23:27pm
v2
Comments
F-ES Sitecore 18-Dec-17 10:28am    
Don't return so many values, no user could possibly go through 2000 results. Instead limit the number of records returned to 100 or so and the user can continue typing to get more specific results.
ranio 18-Dec-17 23:03pm    
but the need is to show all records which could be around 20k atleast. This is the need.
Kasious_KMR 3-Apr-18 9:37am    
Hi, Did you manage to find a solution for this? If you have I would be most grateful if you could post it. thanks a lot

1 solution

The best solution as of now. Please find them in the link below.

https://codeproject.com/Articles/325719/JQueryUI-smartAutocomplete


If you feel this solution works. Please give a green tick to this solution and vote for it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900