View Single Post
  #1 (permalink)  
Old June 24th, 2009, 07:33 AM
abhinaybuiss abhinaybuiss is offline
Registered User
Join Date: Oct 2007
Location: New Mumbai, Maharashtra, India.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Unable to use AutoCompleteExtender

Hello Masters,
I follow ASP.Net 3.5 as a sheep in herd, but AutoCompleteExtender is not working as it is supposed to... Pls see the code I've used

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="AutoCompleteText.aspx.vb" Inherits="AutoCompleteText" %>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">
<head runat="server">
<form id="form1" runat="server">

<asp:ScriptManager ID="ScriptManager1" runat="server">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<cc1:AutoCompleteExtender ID="TextBox1_AutoCompleteExtender" runat="server"
DelimiterCharacters="" Enabled="True" ServiceMethod="GetCompletionList"
TargetControlID="TextBox1" UseContextKey="True">


Imports Microsoft.VisualBasic
Imports System.Collections.Generic
Imports System.Data
Imports System.Data.SqlClient
Partial Class AutoCompleteText
Inherits System.Web.UI.Page
<System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute() > _
Public Shared Function GetCompletionList(ByVal prefixText As String, ByVal count As Integer) As String()
Dim conn As SqlConnection
Dim cmd As SqlCommand
Dim conn_str As String = "Data Source=ABC\SQLEXPRESS;Initial Catalog=VWDB;Integrated Security=True"
Dim cmdStr As String = "SELECT DISTINCT strUser_Firstname FROM tblUserMaster WHERE UPPER(strUser_Firstname) LIKE UPPER('" & prefixText & "%') order by strUser_Firstname"
conn = New SqlConnection(conn_str)
cmd = New SqlCommand(cmdStr, conn)
Dim MyReader As SqlDataReader
Dim returnData As List(Of String) = New List(Of String)
MyReader = cmd.ExecuteReader(CommandBehavior.CloseConnection)
While MyReader.Read
returnData.Add(MyReader("strUser_Firstname").ToStr ing())
End While
Return returnData.ToArray()
End Function
End Class

It does not given any error but it also does not show the rows expected

Please suggest what wrong I'm doing.

Thanks in advance