asp.net(c#)中如何在前端用js写条件查询,且不用调用存储过程
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了asp.net(c#)中如何在前端用js写条件查询,且不用调用存储过程,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1786字,纯文字阅读大概需要3分钟。
内容图文
前端页面(源):
<dx:ASPxButton ID="ASPxButton_Select" runat="server" Text="查询" AutoPostBack="false">
<ClientSideEvents Click="bt_select" />
</dx:ASPxButton>
js部分:
function bt_select() {
//alert(cb_goodstype.GetValue());
updateGrid();
};
function updateGrid() {
var filterCondition = " 1=1 ";
//业务员
if (cb_buyuser.GetSelectedIndex() != -1)
filterCondition += " and ([sureuser] = ‘" + cb_buyuser.GetValue() + "‘) ";
//供应商名称
if (cb_supplers.GetSelectedIndex() != -1)
filterCondition += " and ([peoid]= ‘" + cb_supplers.GetValue() + "‘) ";
//是否审核
if (cb_audflag.GetSelectedIndex() != -1)
filterCondition += " and ([AUDFLAG] = ‘" + cb_audflag.GetValue() + "‘) ";
// alert(filterCondition);
//是否付款
if (cb_iscollflag.GetSelectedIndex() != -1)
filterCondition += " and ([ISCOLLFLAG] = ‘" + cb_iscollflag.GetValue() + "‘) ";
//制订日期
var myDate = new Date();
var theDate = myDate.toLocaleDateString(); //获取今天的日期
//获取控件选择的日期并进行转换
var s = ASPxDateEdit1.GetValue();
var y = new Date(s).getFullYear();
var m = new Date(s).getMonth() + 1;
// m = m < 10 ? (‘0‘ + m) : m;
var d = new Date(s).getDate();
// d = d < 10 ? (‘0‘ + d) : d;
var h = new Date(s).getHours();
var minute = new Date(s).getMinutes();
// minute = minute < 10 ? (‘0‘ + minute) : minute;
var dt = y + ‘/‘ + m + ‘/‘ + d + ‘ ‘ + h + ‘:‘ + minute;
if (ASPxDateEdit1.GetValue())
//filterCondition += " and [PAYDATE] >=‘" + dt + "‘ and [PAYDATE]<=‘" + theDate + "‘";
filterCondition += " and [PAYDATE] >= # " + dt + "# and [PAYDATE]<= #" + theDate + "#";
//alert(filterCondition);
ASPxGridView1.ApplyFilter(filterCondition); //采购商品
ASPxGridView2.ApplyFilter(filterCondition); //采购服务及费用
};
注:以上查询只适用于ASPxGridView中的数据条件查询,其他则不知。
原文:http://www.cnblogs.com/dfxyw/p/5080118.html
内容总结
以上是互联网集市为您收集整理的asp.net(c#)中如何在前端用js写条件查询,且不用调用存储过程全部内容,希望文章能够帮你解决asp.net(c#)中如何在前端用js写条件查询,且不用调用存储过程所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。