富贵资源网 Design By www.hznty.com
复制代码 代码如下:
<asp:TextBox ID="txtTempScenic" runat="server"></asp:TextBox>
<ajax:AutoCompleteExtender ID="txtTempScenic_AutoCompleteExtender" runat="server" BehaviorID="AutoCompleteEx" DelimiterCharacters="" Enabled="True" ServicePath="~/WebService/AutoComplete.asmx" ServiceMethod="GetScenic" TargetControlID="txtTempScenic" CompletionInterval="500" CompletionSetCount="20" EnableCaching="true" MinimumPrefixLength="1"></ajax:AutoCompleteExtender>
AutoComplete.asmx
复制代码 代码如下:
<%@ WebService Language="C#" CodeBehind="~/App_Code/AutoComplete.cs" Class="AutoComplete" %>
AutoComplete.cs
复制代码 代码如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Data;
/// <summary>
///add by ahuinan
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
//若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消对下行的注释。
[System.Web.Script.Services.ScriptService]
public class AutoComplete : System.Web.Services.WebService
{
public AutoComplete()
{
//如果使用设计的组件,请取消注释以下行
//InitializeComponent();
}
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
//获得景区
[WebMethod]
public string[] GetScenic(string prefixText,int count)
{
ET_ERP.BLL.ERP_ScenicArea b_ScenicArea = new ET_ERP.BLL.ERP_ScenicArea();
string strWhere = " SA_Name like '" + prefixText + "%' AND SA_IsDel = 0";
DataSet ds = b_ScenicArea.Select(" top "+count+" SA_Name", strWhere);
count = ds.Tables[0].Rows.Count;
string[] array = new string[count];
for (int i = 0; i < count; i++)
{
array[i] = ds.Tables[0].Rows[i]["SA_Name"].ToString();
}
return array;
}
}
<asp:TextBox ID="txtTempScenic" runat="server"></asp:TextBox>
<ajax:AutoCompleteExtender ID="txtTempScenic_AutoCompleteExtender" runat="server" BehaviorID="AutoCompleteEx" DelimiterCharacters="" Enabled="True" ServicePath="~/WebService/AutoComplete.asmx" ServiceMethod="GetScenic" TargetControlID="txtTempScenic" CompletionInterval="500" CompletionSetCount="20" EnableCaching="true" MinimumPrefixLength="1"></ajax:AutoCompleteExtender>
AutoComplete.asmx
复制代码 代码如下:
<%@ WebService Language="C#" CodeBehind="~/App_Code/AutoComplete.cs" Class="AutoComplete" %>
AutoComplete.cs
复制代码 代码如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Data;
/// <summary>
///add by ahuinan
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
//若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消对下行的注释。
[System.Web.Script.Services.ScriptService]
public class AutoComplete : System.Web.Services.WebService
{
public AutoComplete()
{
//如果使用设计的组件,请取消注释以下行
//InitializeComponent();
}
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
//获得景区
[WebMethod]
public string[] GetScenic(string prefixText,int count)
{
ET_ERP.BLL.ERP_ScenicArea b_ScenicArea = new ET_ERP.BLL.ERP_ScenicArea();
string strWhere = " SA_Name like '" + prefixText + "%' AND SA_IsDel = 0";
DataSet ds = b_ScenicArea.Select(" top "+count+" SA_Name", strWhere);
count = ds.Tables[0].Rows.Count;
string[] array = new string[count];
for (int i = 0; i < count; i++)
{
array[i] = ds.Tables[0].Rows[i]["SA_Name"].ToString();
}
return array;
}
}
富贵资源网 Design By www.hznty.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
富贵资源网 Design By www.hznty.com
暂无评论...