Click here to Skip to main content
12,953,743 members (48,073 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I am using combo box to show supplier name. In search facility when user type “S” in combo box the entire supplier’s list should be display whose name start form “S”, like country, state search facility in any web based application. Same way as per user inputs list should be change.
Can any one know logic behind this
Posted 1-Jan-13 19:59pm
Updated 10-Jul-13 4:05am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You need to use autocomplete ajax extender. Look at this article for description and sample:[^]
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

hey try to use autocomplete extender instead of Conbobox..
Refer Below Link.
AutoComplete extender[^]
ASP.Net Ajax AutoCompleteExtender Without Using Web Service[^]
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

This funcionality is called auto-complete
first of all you will need this js file:

and css file:
jquery-ui-1.8.20.custom.css link of these files on page where you want to use auto-complete just like this:
<script src="Scripts/jquery-ui-1.8.20.custom.min.js" type="text/javascript"></script>
   <link href="Styles/jquery-ui-1.8.20.custom.css" rel="stylesheet" type="text/css" />

2.then use this script:
    <script type="text/javascript">
        $(document).ready(function () {
                source: function (request, response) {
                        type: "POST",
                        contentType: "application/json; charset=utf-8",
                        url: "pagename.aspx/getReason",
                        data: "{'keywords':'" + request.term + "'}",
                        dataType: "json",
                        async: true,
                        success: function (data) {
                        error: function (result) {
                minLength: 2

3.then add this method in code behind (.cs) file:
   public static IList<string> getReason(string keywords)
       int count = 0;
       IList<string> result = new List<string>();
       string constr = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["connectionstring"].ConnectionString;
       SqlConnection con1 = new SqlConnection(constr);
       SqlCommand cmd1 = con1.CreateCommand();
       cmd1.CommandText = "select distinct column_name from tablename where column_name like '%" + keywords + "%'";
           SqlDataReader dr = cmd1.ExecuteReader();
           while (dr.Read())
               if (count == 100)
           return result;
           return null;

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

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,429
CHill60 3,490
Maciej Los 3,103
ppolymorphe 2,020
Jochen Arndt 1,975

Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 10 Jul 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100