1.继续完成 显示列表 搜索显示功能。上周只完成了分页和数据提取,今天完成搜索功能。(中午11点完成)
2.设计经验详细页 (HTML+CSS)
3.列表单行 添加 tooltips ,引导进入经验详细页面。
==================================
asp.net MVC 页面引入的js文件,如何防止缓存?
由于JS文件改动频繁,每次都要手动更改后缀才能防止被缓存。
<script src="~/Scripts/Home/projectExperience.js?v=@DateTime.Now.Millisecond.ToString()" type="text/javascript"></script>
为URL添加一个后缀,就解决缓存问题。(本来想过用js生成一个随机数,但是需要把引入js代码写成 document.write("")。不爽。只能考虑C#的方法了。)
==================================
截至到11:10 终于做完了分页查询功能。 报错多多。
URL传值需要做编码/解码
JS文件:
var startD = $('#inputStartTime').val().replace(/-/g, "");
var endD = $('#inputEndTime').val().replace(/-/g, "");
console.log(startD + "|" + endD);
//日期验证,结束日期不能比开始日期早。
if (parseInt(endD) - parseInt(startD) < 0)
{
alert("结束日期不能比开始日期早");
return;
}
var str_search = "page="+page;
str_search += "&startDate=" + startD;
str_search += "&endDate=" + endD;
str_search += "&keywords=" + encodeURI($('#exper_keywords').val());
str_search += "&expno=" + encodeURI($('#exper_no').val());
str_search += "&bigkings=" + encodeURI($('#exper_bigkinds').val());
str_search += "&smallkings=" + encodeURI($('#exper_smallkinds').val());
str_search += "&expertype=" + encodeURI($('#exper_type').val());
c#文件:
keywords = HttpUtility.UrlDecode(keywords);
expno = HttpUtility.UrlDecode(expno);
bigkings = HttpUtility.UrlDecode(bigkings);
smallkings = HttpUtility.UrlDecode(smallkings);
expertype = HttpUtility.UrlDecode(expertype);
SQL语句忘记打单引号
if (!string.IsNullOrEmpty(keywords))
{
columnList.Add(new Tuple<string, object>("keywords", keywords));
strWhere = strWhere + string.Format(" and t1.QUESTION LIKE '%{0}%' ", columnList[columnList.Count() - 1].Item2);
}
if (!string.IsNullOrEmpty(expno))
{
columnList.Add(new Tuple<string, object>("expno", expno));
strWhere = strWhere + string.Format(" and t1.GUID ='{0}'", columnList[columnList.Count() - 1].Item2);
}
if (!string.IsNullOrEmpty(bigkings))
{
columnList.Add(new Tuple<string, object>("bigkings", bigkings));
strWhere = strWhere + string.Format(" and t1.PTYPE = '{0}' ", columnList[columnList.Count() - 1].Item2);
}
if (!string.IsNullOrEmpty(smallkings))
{
columnList.Add(new Tuple<string, object>("smallkings", smallkings));
strWhere = strWhere + string.Format(" and t1.STYPE = '{0}' ", columnList[columnList.Count() - 1].Item2);
}
if (!string.IsNullOrEmpty(expertype))
{
columnList.Add(new Tuple<string, object>("expertype", expertype));
strWhere = strWhere + string.Format(" and t1.FAQTYPE = '{0}' ", columnList[columnList.Count() - 1].Item2);
}
以上全部没打。。。后来才打上。
组元数据类型,item不是从0开始,而是从1开始。
columnList.Add(new Tuple<string, object>("keywords", keywords));
strWhere = strWhere + string.Format(" and t1.QUESTION LIKE '%{0}%' ", columnList[columnList.Count() - 1].Item2);
如果写成columnList[columnList.Count() - 1].Item1,则只会取到“keywords”