筛选功能,有代码,大神来!!!

        [AjaxMethod()]
        public ArrayList GetSearchItems(string strQuery)
        {
            string con = ConfigurationManager.ConnectionStrings["SQLServerConnectionString"].ConnectionString;
            SqlDataAdapter sda = new SqlDataAdapter("select distinct expand6 from wiscommon.dbo.ifs_userwell where userid=" + base.GetUserId() + "; ", con);
            DataSet ds = new DataSet();
            sda.Fill(ds);
            //生成数据源
            ArrayList items = new ArrayList();
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                string cname = ds.Tables[0].Rows[i]["expand6"].ToString();
                items.Add(cname);
            }
            //筛选数据
            ArrayList selectItems = new ArrayList();
            foreach (string str in items)
            {
                if (str.ToUpper().IndexOf(strQuery.ToUpper()) == 0)
                {
                    selectItems.Add(str);
                }
            }
            return selectItems;
        }

 

 

绑定,筛选,都有,,问题是,红色的区域,,,,假如上面items里面有5条数据,分别是...xyz,xzz,yzz,yaa,tcc...5条,我下面筛选数据,现在实现的是,当输入x时....yzz,yaa,tcc不显示了,想要做成,5条数据都显示,当输入x时,xyz,xzz,变颜色,有大神在吗?在线等...解决了加分噢!

慕斯709654
浏览 281回答 1
1回答

慕工程0101907

你这不是AjaxMethod吗?只提供数据,前台显示什么颜色跟后台没关系,你在前台控制就行了,具体看你JS。
打开App,查看更多内容
随时随地看视频慕课网APP