Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Professionals
| Search | Today's Posts | Mark Forums Read
ASP.NET 3.5 Professionals If you are an experienced ASP.NET programmer, this is the forum for your 3.5 questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Professionals section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 24th, 2009, 07:33 AM
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" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>AutoCompleteText</title>
</head>
<body>
<form id="form1" runat="server">
<div>

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

</div>
</form>
</body>
</html>



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)
conn.Open()
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
abhinaybuiss
  #2 (permalink)  
Old June 24th, 2009, 12:36 PM
Lee Dumond's Avatar
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Have you tested your command SQL to see if it actually returns any data?
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
  #3 (permalink)  
Old June 25th, 2009, 02:35 AM
Registered User
 
Join Date: Oct 2007
Location: New Mumbai, Maharashtra, India.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello Lee,
Yes the SQL returns records.

Thanks
abhinaybuiss

Last edited by abhinaybuiss; July 18th, 2009 at 01:00 AM.. Reason: Reminder
  #4 (permalink)  
Old July 18th, 2009, 01:02 AM
Registered User
 
Join Date: Oct 2007
Location: New Mumbai, Maharashtra, India.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation No reply yet

Dear Masters,
Pls suggest, as I'm not able to use the control.

Abhinay
  #5 (permalink)  
Old August 21st, 2009, 02:25 AM
Authorized User
 
Join Date: Jun 2009
Posts: 18
Thanks: 1
Thanked 0 Times in 0 Posts
Default Give you the suggestion

Hi,friend!
Code:
<cc1:AutoCompleteExtender ID="TextBox1_AutoCompleteExtender" runat="server" 
            DelimiterCharacters="" Enabled="True" ServiceMethod="GetCompletionList" 
            TargetControlID="TextBox1" UseContextKey="True">
        </cc1:AutoCompleteExtender>
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.


Similar Threads
Thread Thread Starter Forum Replies Last Post
AJAX Control Toolkit AutoCompleteExtender ilegend .NET Framework 3.5 0 September 24th, 2008 03:50 AM
unable to connect sultan SQL Server 2005 1 June 6th, 2008 03:38 PM
Unable to create database. rupen SQL Server 2005 4 December 6th, 2007 02:39 AM
Unable to get the project etc.. MoeShall BOOK: ASP.NET Website Programming Problem-Design-Solution 1 April 8th, 2005 07:12 AM
Unable to Update phungleon Access ASP 5 March 18th, 2004 05:23 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.