Paschal Obilor

Paschal Obilor

  • 1.6k
  • 104
  • 2.8k

AutoComplete Extender Doesn't Work...

Jun 14 2011 4:27 PM
I need help regarding a AutoComplete Extender that I am using. I Added an AutoComplete Extender on my ASP.NET application, then wrote the code for the webservice. It doesn't seem to work. The webservice works perfectly because I debugged it and got what I needed from it. But it doesn't display the suggested information when I type into the textbox. Can someone come to my aid....
 Below is the code:

<%
<%
@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test2.aspx.cs" Inherits="EVENTually.Test2" %>@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %><!
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></title>head>body>

<form id="form1" runat="server">



<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">

<Services>

<asp:ServiceReference Path="~/AutoComplete.asmx"/>

</Services>

</asp:ToolkitScriptManager>

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

<asp:AutoCompleteExtender ID="AutoCompleteExtender1" TargetControlID="TextBox1" ServicePath="AutoComplete.asmx"



MinimumPrefixLength="2" CompletionInterval="1000" CompletionSetCount="12" EnableCaching="true" ServiceMethod="GetDisplayName" runat="server" >

</asp:AutoCompleteExtender>

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

--------------------------------------------------------------------------------------------------------


using
System;using
System.Collections.Generic;using
System.Linq;using
System.Web;using
System.Web.Services;using
System.Web.Services.Protocols;using
System.Data;using
System.Data.OleDb;using
System.Data.OracleClient;using
System.Configuration;using
EVENTuallyBL;namespace
{


EVENTually/// <summary>

/// Summary description for AutoComplete

/// </summary>[
[
[System.ComponentModel.


WebService(Namespace = "http://tempuri.org/")]WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]ToolboxItem(false)]// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. [System.Web.Script.Services.


ScriptService]public class AutoComplete : System.Web.Services.WebService{
[


{










WebMethod]public string[] GetDisplayName(string prefixdisplayname)string constr = ConfigurationManager.ConnectionStrings["EventuallyConn"].ToString();BusinessLayer businesslayer = new BusinessLayer();DataSet ds;//if (count == 0)

//{

// count = 10;

//}

conn.Open();


cmd.CommandText =
cmd.CommandType =
cmd.Parameters.Add(
cmd.Parameters.Add(


ds =
da.Fill(ds);
ds = businesslayer.DisplayName(prefixdisplayname);






{
items.Add(ds.Tables[0].Rows[i][
}




}
}
}
OracleConnection conn = new OracleConnection(constr);OracleCommand cmd = conn.CreateCommand();"SP_GetDisplaynames";CommandType.StoredProcedure;"s_displayname", OracleType.VarChar).Value = prefixdisplayname + "%";"s_getdisplayname", OracleType.Cursor).Direction = ParameterDirection.Output;OracleDataAdapter da = new OracleDataAdapter(cmd);new DataSet();int cnt = ds.Tables[0].Rows.Count;List<string> items = new List<string>();for (int i = 0; i < ds.Tables[0].Rows.Count; i++)"Display_Name"].ToString());return items.ToArray();


public
{




conn.Open();


cmd.CommandText =
cmd.CommandType =
cmd.Parameters.Add(
cmd.Parameters.Add(


ds =
da.Fill(ds);




}
DataSet DisplayName(string displayname)DataSet ds;OracleConnection conn = new OracleConnection(constr);OracleCommand cmd = conn.CreateCommand();"SP_GetDisplaynames";CommandType.StoredProcedure;"s_displayname", OracleType.VarChar).Value = displayname + "%";"s_getdisplayname", OracleType.Cursor).Direction = ParameterDirection.Output;OracleDataAdapter da = new OracleDataAdapter(cmd);new DataSet();return ds;

Answers (2)