Ajax,谷歌提示AutoCompleteExtender控件
来源:互联网 发布:ansys cfd软件 编辑:程序博客网 时间:2024/04/29 02:33
提示内容从数据库中读取:
------------------------------------------页面
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<!--df-->
歌曲名称:<asp:TextBox ID="txtSongName" runat="server"></asp:TextBox>
<asp:Button ID="btnSelect" runat="server" Text="搜索" onclick="btnSelect_Click" />
<cc1:AutoCompleteExtender ID="AutoCompleteExtender1" ServicePath="WebService.asmx" MinimumPrefixLength="1" TargetControlID="txtSongName" runat="server" ServiceMethod="GetCompletionList" UseContextKey="True">
</cc1:AutoCompleteExtender>
<!--
1.TargetControlID:指定将被辅助完成自动输入的控件ID,这里的控件只能是TextBox;
2.ServicePath:指出提供服务的WEB服务路径,若不指出则ServiceMethod表示本页面对应的方法名;
3.ServiceMethod:指出提供服务的方法名;
4.MinimumPrefixLength:指出开始提供提示服务时,TextBox控件应有的最小字符数,默认为3;
5.CompletionSetCount:显示的条数,默认为10;
6.EnableCaching:是否在客户端缓存数据,默认为true;
7.CompletionInterval:从服务器读取数据的时间间隔,默认为1000,单位:毫秒
-->
------------------------------------------WebServices.asmx服务的WebService.cs
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services
using System.Web.Services.Protocols;
using System.Xml.Linq;
using System.Data.SqlClient;
/// <summary>
///WebService 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
//若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消对下行的注释。
[System.Web.Script.Services.ScriptService]
public class WebService : System.Web.Services.WebService {
public WebService () {
//如果使用设计的组件,请取消注释以下行
//InitializeComponent();
}
[WebMethod]
public string[] GetSuperviserList(string prefixText)
{
List<string> items = new List<string>();//泛型
string sql = "select songName from Music where songName like '%" + key + "%'";
SqlConnection conn = new SqlConnection("Data Source=AP-HZ-00052\\SQLEXPRESS;Initial Catalog=Test;Integrated Security=True");
conn.Open();
SqlCommand cmd = new SqlCommand(sql, conn);
SqlDataReader dr= cmd.ExecuteReader();
while (dr.Read())
{
items.Add(dr[0].ToString());
}
dr.Close();
conn.Close();
return items.ToArray();
}
}
- Ajax,谷歌提示AutoCompleteExtender控件
- Ajax 自动提示 AutoCompleteExtender
- 体验AJAX Toolkit新控件:AutoCompleteExtender
- Ajax学习札记(一)AutoCompleteExtender控件
- ajax控件AutoCompleteExtender实现智能下拉框。
- Ajax学习笔记(一):AutoCompleteExtender控件
- 关于Ajax控件中的AutoCompleteExtender控件的一个简单应用
- 关于Ajax控件中的AutoCompleteExtender控件的一个简单应用
- AutoCompleteExtender控件实现类似百度,谷歌,雅虎的下拉提示
- ajax:AutoCompleteExtender版本问题
- AutoCompleteExtender控件的使用
- AjaxControlToolkit之AutoCompleteExtender控件
- AjaxControlToolkit AutoCompleteExtender控件演示
- ASP.NET2.0AJAX控件之AutoCompleteExtender与数据库链接使用
- Ajax扩展控件AutoCompleteExtender 连接sql数据库 实现仿Google自动生成功能
- Ajax的AutoCompleteExtender的使用
- Ajax的AutoCompleteExtender的使用
- Ajax.Net--AutoCompleteExtender & CascadingDropDownList & ListSearchExtender
- java使用jxl解析Excel
- 关于使用JAVA调用c 或者c++的DLL的吐槽
- 中文数字版atoi【Java实现】
- NYOJ 613 免费馅饼
- 音频播放 AVAudioPlayer
- Ajax,谷歌提示AutoCompleteExtender控件
- 翻转句子中单词的顺序
- 清除chrome的host DNS缓存
- Android 实现QQ第三方登录
- PAT(A)1084. Broken Keyboard
- 回文数
- 二叉树的遍历(递归和非递归)
- UVa - 10780 - Again Prime? No Time.
- UVa10917 - Walk Through the Forest(单源最短路径及动态规划)