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());
       }

  • 相关阅读:
    20151104内置对象
    20151102adonet2
    20151029adonet1
    20151028c#4
    20151027c#3
    20151026c#2
    20151021c#1
    20151020sql2
    20151019sql1
    Codeforces Round #261 (Div. 2) C. Pashmak and Buses(思维+构造)
  • 原文地址:https://www.cnblogs.com/ejiyuan/p/922214.html
Copyright © 2011-2022 走看看