zoukankan      html  css  js  c++  java
  • URL参数搜索

    1,构造URL搜索参数
       string strSearch = string.Empty;
       if (this.dropDistrict.SelectedIndex != 0)
       {
        strSearch += String.Format("{0} = '{1}'",( user.userID.Substring(0,6) == "230000") ? "City" : "District",dropDistrict.SelectedValue);
       }
       if (DropFQualiClassID.SelectedValue != "0")
       {
        strSearch += String.Format(" AND FQualiClassID = '{0}'",DropFQualiClassID.SelectedValue);
       }
       if (this.dropFQualiNclassID.SelectedValue != "0")
       {
        strSearch += String.Format(" AND FQualiNclassID = '{0}'",dropFQualiNclassID.SelectedValue);
       }
       if (dropFQualification.SelectedValue != "0")
       {
        strSearch += String.Format(" AND FQualification = '{0}'",dropFQualification.SelectedValue);
       }
       if (txtEnterName.Text.Trim() != "")
       {
        strSearch += String.Format(" AND FName LIKE '%{0}%'",txtEnterName.Text.Trim());
       }
       if (this.dropFYear.Visible)
       {
        strSearch += String.Format(" AND FYear = '{0}'",dropFYear.SelectedValue.Trim());
       }
       if (this.dropFQuarter.Visible)
       {
        strSearch += String.Format(" AND FQuarter = '{0}'",dropFQuarter.SelectedValue.Trim());
       }
       if (strSearch.Length > 5 && strSearch.Substring(0,5)==" AND ")
       {
        strSearch = strSearch.Remove(0,5);
       }

       if (strSearch.Length > 0)
       {
        Response.Redirect(String.Format("Enterprise/ApproveList.aspx?strSearch={0}",strSearch));
       }
       else
       {
        Response.Redirect("Enterprise/ApproveList.aspx");
       }
    2,ApproveList.aspx 接收搜索参数 执行搜索
       if (Request.QueryString["strSearch"] != null)
       {
        DataTable dtTemp = dt.Copy();
        dt.Rows.Clear();
        dt = FilterBind(dtTemp,Request.QueryString["strSearch"].Trim());
       }

  • 相关阅读:
    jenkins代码自动部署
    jenkins安装
    git图形管理工具
    gitlab自动备份恢复与卸载
    linux下获取外网IP
    网站安全webshell扫描
    jQuery动画效果实现
    form表单中的enctype属性什么意思?
    你那么努力又怎么样!
    话语
  • 原文地址:https://www.cnblogs.com/ejiyuan/p/922214.html
Copyright © 2011-2022 走看看