Ajax AutcompletExtender not returning any results

Fn-Mi

New Member
I have a text box, a script manager and an auto-complete extender on an aspx page. I'm trying to simply have an auto complete into the text box and am currently getting nothing. What am I missing? When I try to debug the code the break point never gets beyond the first curly brace in the GetComplete method. I'm on VS2010markup:\[code\]<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="AjaxAutocomplete._Default" %><%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %><asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"></asp:Content><asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"><asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:AutoCompleteExtender ID="TextBox1_AutoCompleteExtender" runat="server" DelimiterCharacters="" Enabled="True" ServiceMethod="GetComplete" MinimumPrefixLength="3" TargetControlID="TextBox1"> </asp:AutoCompleteExtender></asp:Content>\[/code\]code behind:\[code\]using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Data;using System.Data.SqlClient;using System.Configuration;namespace AjaxAutocomplete{ public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } [System.Web.Script.Services.ScriptMethod] [System.Web.Services.WebMethod] public static List<string> GetComplete(string Prefixtetxt) { List<string> returnList = new List<string>(); string cs = ConfigurationManager.ConnectionStrings["dbcs"].ConnectionString; using (SqlConnection conn = new SqlConnection(cs)) { conn.Open(); using (SqlCommand cmd = new SqlCommand()) { cmd.CommandType = CommandType.StoredProcedure; SqlParameter p = new SqlParameter("@drug_name", Prefixtetxt); //cmd.Parameters.AddWithValue("@drug_name", p); cmd.Parameters.Add("@drug_name", SqlDbType.VarChar); using (SqlDataReader reader = cmd.ExecuteReader()) { returnList.Add(Convert.ToString(reader["drug_name"])); } } } return returnList; } }}\[/code\]sproc from Sql Server\[code\]create proc spFindAllDrugs@drug_name varchar(100)asbeginselect distinct drug_name from rx where drug_name like '%' + @drug_name + '%'end\[/code\]
 
Top