.Net 文本框实现内容提示的实例代码(仿Google、B(2)

namespace WebApplication1
{
    public partial class TextBoxAuto : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

}

[System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()]
        public static string[][] GetCompanyNameList(string prefixText, int count, string contextKey)
        {
            //获取自动完成的选项数据
            List<string[]> list = new List<string[]>();
            List<string> nameList = new List<string>();
            List<string> idList = new List<string>();
            CeshiManage ceshimanage = new CeshiManage();

ceshimanage.GetTopUserName(count, prefixText.ToUpper(), out idList, out nameList);
            for (int i = 0; i < nameList.Count; i++)
            {
                string[] Respuesta = new string[2];
                Respuesta[0] = nameList[i];
                Respuesta[1] = idList[i];
                list.Add(Respuesta);
            }
            return list.ToArray();
        }
    }
}


6.后台页面用到的方法(管理类)

复制代码 代码如下:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI;
using Oceansoft.Net.Bll;
using SubSonic;
using System.Transactions;


using System.Data;
using Oceansoft.Net.Dal;

namespace Oceansoft.Net.Bll
{
    /// <summary>
    /// :ceshi
    /// :jibp
    /// :2014-2-27 15:52:15
    ///</summary>
    public class CeshiManage
    {

private SqlQuery m_sqlquery = Oceansoft.Net.Dal.DB.Select().From(Ceshi.Schema);

/// <summary>
        /// Ceshi查询器
        /// </summary>
        public SqlQuery CeshiSelecter
        {
            get { return m_sqlquery; }
            set { m_sqlquery = value; }
        }


        /// <summary>
        /// 构造函数,设置查询器
        ///</summary>
        public CeshiManage()
        {
            m_sqlquery = m_sqlquery.Where("id").IsNotEqualTo("");
        }


        #region Ceshi管理

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wjzxfw.html