zoukankan      html  css  js  c++  java
  • asp.net(c#)中如何在前端用js写条件查询,且不用调用存储过程

    前端页面(源):

    <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中的数据条件查询,其他则不知。

  • 相关阅读:
    Zookeeper安装-单机版
    Centos 7 安装 Redis 5
    java利用dom4j将xml字符串转换为json
    计算机科学导论笔记-计算机组成
    计算机科学导论笔记-数据运算
    计算机科学导论笔记-数据存储
    计算机科学导论笔记-数字系统
    计算机科学导论笔记
    springmvc03
    springmvc02
  • 原文地址:https://www.cnblogs.com/dfxyw/p/5080118.html
Copyright © 2011-2022 走看看