p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 3.5 Professionals (http://p2p.wrox.com/forumdisplay.php?f=352)
-   -   Unable to use AutoCompleteExtender (http://p2p.wrox.com/showthread.php?t=74925)

abhinaybuiss June 24th, 2009 07:33 AM

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" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<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

Lee Dumond June 24th, 2009 12:36 PM

Have you tested your command SQL to see if it actually returns any data?

abhinaybuiss June 25th, 2009 02:35 AM

Hello Lee,
Yes the SQL returns records.


abhinaybuiss July 18th, 2009 01:02 AM

No reply yet
Dear Masters,
Pls suggest, as I'm not able to use the control.[:(]


Michael YoeH August 21st, 2009 02:25 AM

Give you the suggestion

<cc1:AutoCompleteExtender ID="TextBox1_AutoCompleteExtender" runat="server"
            DelimiterCharacters="" Enabled="True" ServiceMethod="GetCompletionList"
            TargetControlID="TextBox1" UseContextKey="True">

Actually,there is another property "ServicePath" you didn't add to AutoCompleteExtender . I think it's the problem that you haven't seen the result.

All times are GMT -4. The time now is 06:35 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.