1
필요 다음 ASPXAutoCompleteExtender 도움이 나는이 간단한 솔루션입니다 확신하지만 난 <p></p> 내가 가진 .. 내 말에 나는
<asp:TextBox ID="textVendorNameLookup" AutoPostBack="true" runat="server" Width="200px"
onFocus="this.select()"
Text=''></asp:TextBox>
<ajaxToolkit:AutoCompleteExtender ID="VendorNameAutoCompleteExtender" TargetControlID="textVendorNameLookup"
FirstRowSelected="false" runat="server" ServiceMethod="GetVendor" CompletionInterval="1"
EnableCaching="true" MinimumPrefixLength="1" UseContextKey="true" ServicePath="VendorLookupWebService.asmx">
</ajaxToolkit:AutoCompleteExtender>
그리고 다음 ASMX
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Services;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Xml;
/// <summary>
/// Summary description for VendorLookupWebService
/// </summary>
[WebService(Namespace = "http://rouses.com/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// 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 VendorLookupWebService : System.Web.Services.WebService
{
public VendorLookupWebService()
{
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
//public string[] GetOrganization(string prefixText)
public static List<String> GetVendor(string prefixText)
{
var cmdText = "Select vmvnnm from dbmoto..apvendp where vmvnnm like @prefixText and vmasts = 'A'";
using (var conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MAINConnectionString"].ToString()))
using (var cmd = new SqlCommand(cmdText, conn))
{
cmd.Parameters.Add(new SqlParameter("@prefixText", string.Format("%{0}%", prefixText)));
conn.Open();
SqlDataReader dr = cmd.ExecuteReader();
var Vendors = new List<string>();
if (dr.HasRows)
{
while (dr.Read())
{
Vendors.Add(dr["vmvnnm"].ToString());
}
}
conn.Close();
return Vendors;
}
}
}
나는 텍스트 상자에 입력 할 때 그러나 웹 서비스는 ....
어떤 아이디어를 발사되지 않는 이유는 무엇입니까? 언급 here로
public string[] GetVendor(string prefixText, int count)
:
!!!! – larryr