标签:
今天工作中遇到的问题有2个,
1,js传递中文参数到一般处理程序,字符的编码转换,js 使用escape 方法
var searchs = $("#txtSearch").val(); //list页面搜索框 if (searchs != "请输入小区名称或地址...") { var search = escape(searchs); } else { search = ""; }
一般处理程序端对代码解密
1 if (!string.IsNullOrEmpty(keyword)) 2 { 3 string key = context.Server.UrlDecode(keyword); 4 query = query.Where(w => w.SQ_CODE.Contains(key) || w.HOUSE_TITLE.Contains(key) || w.ESTATE_NAME.Contains(key)); 5 6 }
2,lambam 表达式里面的多条件查询,其实很简单,只是一开始没有看懂
EFModel.ChlWebEntities ent = new EFModel.ChlWebEntities(); //EF 多条件跨表 查询 //List<EFModel.trm_f_house> zu_list = null; //为什么走到这里会报错 var query = ent.trm_f_house.AsQueryable<EFModel.trm_f_house>(); query=query.Where(w => w.HOUSE_TYPE == "0" && w.STATUS == "A" ); int totalCount = 0; if (region != "-1") { query = query.Where(w => w.AREA_CODE == region); } if (price != "-1") { string[] strpri = price.Split(‘,‘); double aaa = Convert.ToDouble(strpri[0]); double bbb = Convert.ToDouble(strpri[1]); if (aaa == 0.0) { query = query.Where(w => w.SELL_PRI <= bbb); } if (bbb == 500.0) { query = query.Where(w => w.SELL_PRI >= aaa); } query = query.Where(w => w.SELL_PRI >= aaa && w.SELL_PRI <= bbb); }
3.限制文本框只能输入数字
1 onkeyup="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,‘‘)}else{this.value=this.value.replace(/\D/g,‘‘)}" 2 onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,‘‘)}else{this.value=this.value.replace(/\D/g,‘‘)}"
4,lambamd表达式排序,用iqueryable方式的排序 目前还没有解决。
标签:
原文地址:http://www.cnblogs.com/flyfengling/p/4960202.html