下拉框 动态模糊查询

$(function () {
//城市
$("#u_loupancity").autocomplete(具体URL)
$("#u_loupancity").blur(function () {
$("#u_loupanname").unbind();
$("#loupanid").val("");
$("#u_loupanname").val("");
//楼盘
$("#u_loupanname").autocomplete(具体URL, {
extraParams: { City: function () { return $("#u_loupancity").val(); }, cacheLength: 0 },
mustMatch: true //如果设置为true,autoComplete只会允许匹配的结果出现在输入框,所有当用户输入的是非法字符时将会得不到下拉框,Default:false
});
});
});

 

public ActionResult GetCityNameJson(string q)
{
q = "%" + q + "%";
List<Area> area = AreaBLL.GetCityListByName(q);
List<string> list = new List<string>();
foreach (var i in area)
{
list.Add(i.Name);
}
return Content(string.Join("\n", list), "text/text");
}

 

public ActionResult GetLouPanNameFromLouPanManage(string City, string q)
{

int companyEnum = Common.Common.GetUserBelongCompany();
List<string> list = new List<string>(); // List of city names
List<LouPanManage> hit = LouPanManageBLL.GetLouPanName(City, q, companyEnum);

foreach (var i in hit)
{
list.Add(i.LouPanName);
}
return Content(string.Join("\n", list), "text/text");
//return Json(list, JsonRequestBehavior.AllowGet); ;


}

 

JS为Select下拉框增加输入功能

  1. <div style="position:relative;">  
  2. <span style="margin-left:100px;width:18px;overflow:hidden;">  
  3. <select style="width:118px;margin-left:-100px" onchange="this.parentNode.nextSibling.value=this.value">  
  4. <option value="天蓝蓝">天蓝蓝</option>  
  5. <option value="草绿绿">草绿绿</option>  
  6. <option value="水清清">水清清</option>  
  7. </select></span><input name="box" style="width:100px;position:absolute;left:0px;"> 

楼盘基本信息

@*
@*保存修改
*@
    • *楼盘所在城市
    •  
    • *楼盘名称
    •  
posted @ 2016-05-11 10:27  华琪  阅读(1132)  评论(0编辑  收藏  举报