Click here to Skip to main content
11,930,231 members (46,657 online)
Rate this:
Please Sign up or sign in to vote.
See more: VB VB.NET
i use the auto suggest box without web serivce it reteriving the value from the database properly but it will not show the list on the web page.
can any one help me
here is my html code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="" >
<head runat="server">
    <title>Untitled Page</title>
    <form id="form1" runat="server">
    &nbsp;<cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
<asp:TextBox ID="txtCountry" runat="server"></asp:TextBox>
    <cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server"  TargetControlID="txtCountry"
MinimumPrefixLength="1" EnableCaching="true" CompletionSetCount="1" CompletionInterval="1000" ServiceMethod="GetCountries" >
and it is my code
Imports System.Data
Imports System.Data.SqlClient
Imports System.Collections.Generic
Imports System.Configuration
Partial Class Default2
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    End Sub
    <> _
<> _
Public Shared Function GetCountries(ByVal prefixText As String) As List(Of String)
        Dim con As New SqlConnection(ConfigurationManager.ConnectionStrings("appraisalConnectionString").ToString())
        Dim cmd As New SqlCommand("select * from tblCountry where CountryName like @Name+'%'", con)
        cmd.Parameters.AddWithValue("@Name", prefixText)
        Dim da As New SqlDataAdapter(cmd)
        Dim dt As New DataTable()
        Dim CountryNames As New List(Of String)()
        For i As Integer = 0 To dt.Rows.Count - 1
        Return CountryNames
    End Function
End Class
Posted 20-Mar-13 21:33pm
Edited 20-Mar-13 21:48pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Hello Supriya,

Try increasing CompletionSetCount. As per documentation the signature of the Service method should be as shown below.
public string[] GetCompletionList(string prefixText, int count)
I will also recommend you to go through this[^] article.

supriya931 21-Mar-13 3:00am
it will not shoe the data in list on page
it fectching from database but not shoe in list
Prasad Khandekar 21-Mar-13 3:26am
Try to test in FireFox. See if you get any errors in Error Console(Ctrl + Shift + J), Or in Script Tab of IE Developers Tool.

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

Advertise | Privacy | Mobile
Web01 | 2.8.151126.1 | Last Updated 21 Mar 2013
Copyright © CodeProject, 1999-2015
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