TEL:150-0382-3679
新闻资讯 News Center
建站知识 / 公司动态
多条件搜索 标示定位

做到如下效果:


cs文件获取并组合地址文件来的参数,以获取搜索条件:
urlinfo = HttpContext.Current.Request.Url.PathAndQuery;

 StringBuilder sqlapp = new StringBuilder();
            sqlapp.Append("1=1 ");
            if (Request.QueryString["moneystate"] != null && Request.QueryString["moneystate"] != "")
            {
                switch (Request.QueryString["moneystate"].Trim())
                {
                    case "1":
                        sqlapp.Append("and gratuitystate like '%已预付款%'");
                        moneystate1.BackColor = System.Drawing.Color.FromArgb(84, 171, 219);

                        break;
                    case "2":
                        sqlapp.Append("and gratuitystate like '%保证选稿%'");
                        moneystate2.BackColor = System.Drawing.Color.FromArgb(84, 171, 219);

                        break;

                    default:
                        moneystate0.BackColor = System.Drawing.Color.FromArgb(84, 171, 219);
                        break;
                }

            }
            else
            {
                moneystate0.BackColor = System.Drawing.Color.FromArgb(84, 171, 219);
            }
            if (Request.QueryString["money"] != null && Request.QueryString["money"] != "")
            {
                switch (Request.QueryString["money"].Trim())
                {
                    case "1":
                        sqlapp.Append("and ispay < 500.00");
                        LinkButton5.BackColor = System.Drawing.Color.FromArgb(84, 171, 219);
                        break;
                    case "2":
                        sqlapp.Append("and Money between 500.00 and 1000.00");
                        LinkButton6.BackColor = System.Drawing.Color.FromArgb(84, 171, 219);
                        break;
                    case "3":
                        sqlapp.Append("and  Money between 1000.00 and 2000.00");
                        LinkButton7.BackColor = System.Drawing.Color.FromArgb(84, 171, 219);
                        break;
                    case "4":
                        sqlapp.Append("and  Money between 2000.00 and 5000.00");
                        LinkButton8.BackColor = System.Drawing.Color.FromArgb(84, 171, 219);
                        break;
                    case "5":
                        sqlapp.Append("and Money between 5000.00 and 10000.00");
                        LinkButton9.BackColor = System.Drawing.Color.FromArgb(84, 171, 219);
                        break;
                    case "6":
                        sqlapp.Append("and Money > 10000.00");
                        LinkButton10.BackColor = System.Drawing.Color.FromArgb(84, 171, 219);
                        break;


                    default:
                        LinkButton4.BackColor = System.Drawing.Color.FromArgb(84, 171, 219);
                        break;
                }
            }
            else
            {
                LinkButton4.BackColor = System.Drawing.Color.FromArgb(84, 171, 219);
            }
            if (Request.QueryString["deep"] != null && Request.QueryString["deep"] != "")
            {
                switch (Request.QueryString["deep"].Trim())
                {
                    case "0":
                        sqlapp.Append("and 1=1");
                        LinkButton11.BackColor = System.Drawing.Color.FromArgb(84, 171, 219);
                        break;
                    case "1":
                        sqlapp.Append("and ispay=0");
                        LinkButton12.BackColor = System.Drawing.Color.FromArgb(84, 171, 219);
                        break;
                    case "2":
                        sqlapp.Append("and  ispay=1");
                        LinkButton13.BackColor = System.Drawing.Color.FromArgb(84, 171, 219);
                        break;


                    default:
                        break;
                }
            }
            else
            {
                LinkButton11.BackColor = System.Drawing.Color.FromArgb(84, 171, 219);
            }
            if (Request.QueryString["sort"] != null && Request.QueryString["sort"] != "")
            {
                switch (Request.QueryString["sort"].Trim())
                {
                    case "0":
                        sortby = "order by id desc";
                        LinkButton15.BackColor = System.Drawing.Color.FromArgb(84, 171, 219);
                        break;
                    case "1":
                        sortby = "order by Money desc,id desc";
                        LinkButton16.BackColor = System.Drawing.Color.FromArgb(84, 171, 219);
                        break;
                    case "2":
                        sortby = "order by click desc,id desc";
                        LinkButton17.BackColor = System.Drawing.Color.FromArgb(84, 171, 219);
                        break;
                    case "3":
                        sortby = "order by bidcount desc,id desc";
                        LinkButton18.BackColor = System.Drawing.Color.FromArgb(84, 171, 219);
                        break;

                    default:
                        LinkButton15.BackColor = System.Drawing.Color.FromArgb(84, 171, 219);
                        break;
                }
            }

cs文件获取并组合地址文件来传递参数:
 protected void moneystate0_Click(object sender, EventArgs e)
    {

        string s2 = "";
        if (urlinfo.IndexOf("&moneystate=") > 0)
        {
            string s1 = urlinfo.IndexOf("&moneystate=").ToString();
            s2 = urlinfo.Remove(urlinfo.IndexOf("&moneystate="), 13);
            s2 = s2 + "&moneystate=0";
           
        }
        else
        { s2 = urlinfo + "&moneystate=0"; }
        Response.Redirect(s2);
       
    }
    protected void moneystate1_Click(object sender, EventArgs e)
    {

        string s2 = "";
        if (urlinfo.IndexOf("&moneystate=") > 0)
        {
            string s1 = urlinfo.IndexOf("&moneystate=").ToString();
            s2 = urlinfo.Remove(urlinfo.IndexOf("&moneystate="), 13);
            s2 = s2 + "&moneystate=1";
        }
        else
        { s2 = urlinfo + "&moneystate=1"; }
    
        Response.Redirect(s2);
    }
    protected void moneystate2_Click(object sender, EventArgs e)
    {
        string s2 = "";
        if (urlinfo.IndexOf("&moneystate=") > 0)
        {
            string s1 = urlinfo.IndexOf("&moneystate=").ToString();
            s2 = urlinfo.Remove(urlinfo.IndexOf("&moneystate="), 13);
            s2 = s2 + "&moneystate=2";
        }
        else
        { s2 = urlinfo + "&moneystate=2"; }
      
        Response.Redirect(s2);
    }
    protected void LinkButton4_Click(object sender, EventArgs e)
    {
      
        string s2 = "";
        if (urlinfo.IndexOf("&money=") > 0)
        {
            string s1 = urlinfo.IndexOf("&money=").ToString();
            s2 = urlinfo.Remove(urlinfo.IndexOf("&money="), 8);
            s2 = s2 + "&money=0";
        }
        else
        { s2 = urlinfo + "&money=0"; }

        Response.Redirect(s2);
     
    }
    protected void LinkButton5_Click(object sender, EventArgs e)
    {
        string s2 = "";
        if (urlinfo.IndexOf("&money=") > 0)
        {
            string s1 = urlinfo.IndexOf("&money=").ToString();
            s2 = urlinfo.Remove(urlinfo.IndexOf("&money="), 8);
            s2 = s2 + "&money=1";
        }
        else
        { s2 = urlinfo + "&money=1"; }

        Response.Redirect(s2);

    }
    protected void LinkButton6_Click(object sender, EventArgs e)
    {
        string s2 = "";
        if (urlinfo.IndexOf("&money=") > 0)
        {
            string s1 = urlinfo.IndexOf("&money=").ToString();
            s2 = urlinfo.Remove(urlinfo.IndexOf("&money="), 8);
            s2 = s2 + "&money=2";
        }
        else
        { s2 = urlinfo + "&money=2"; }

        Response.Redirect(s2);
    }
    protected void LinkButton7_Click(object sender, EventArgs e)
    {
        string s2 = "";
        if (urlinfo.IndexOf("&money=") > 0)
        {
            string s1 = urlinfo.IndexOf("&money=").ToString();
            s2 = urlinfo.Remove(urlinfo.IndexOf("&money="), 8);
            s2 = s2 + "&money=3";
        }
        else
        { s2 = urlinfo + "&money=3"; }

        Response.Redirect(s2);
    }
    protected void LinkButton8_Click(object sender, EventArgs e)
    {
        string s2 = "";
        if (urlinfo.IndexOf("&money=") > 0)
        {
            string s1 = urlinfo.IndexOf("&money=").ToString();
            s2 = urlinfo.Remove(urlinfo.IndexOf("&money="), 8);
            s2 = s2 + "&money=4";
        }
        else
        { s2 = urlinfo + "&money=4"; }

        Response.Redirect(s2);
    }
    protected void LinkButton9_Click(object sender, EventArgs e)
    {
        string s2 = "";
        if (urlinfo.IndexOf("&money=") > 0)
        {
            string s1 = urlinfo.IndexOf("&money=").ToString();
            s2 = urlinfo.Remove(urlinfo.IndexOf("&money="), 8);
            s2 = s2 + "&money=5";
        }
        else
        { s2 = urlinfo + "&money=5"; }

        Response.Redirect(s2);
    }
    protected void LinkButton10_Click(object sender, EventArgs e)
    {
        string s2 = "";
        if (urlinfo.IndexOf("&money=") > 0)
        {
            string s1 = urlinfo.IndexOf("&money=").ToString();
            s2 = urlinfo.Remove(urlinfo.IndexOf("&money="), 8);
            s2 = s2 + "&money=6";
        }
        else
        { s2 = urlinfo + "&money=6"; }

        Response.Redirect(s2);
    }
    protected void LinkButton11_Click(object sender, EventArgs e)
    {

        string s2 = "";
        if (urlinfo.IndexOf("&deep=") > 0)
        {
            string s1 = urlinfo.IndexOf("&deep=").ToString();
            s2 = urlinfo.Remove(urlinfo.IndexOf("&deep="), 7);
            s2 = s2 + "&deep=0";
        }
        else
        { s2 = urlinfo + "&deep=0"; }

        Response.Redirect(s2);
      
    }
    protected void LinkButton12_Click(object sender, EventArgs e)
    {
        string s2 = "";
        if (urlinfo.IndexOf("&deep=") > 0)
        {
            string s1 = urlinfo.IndexOf("&deep=").ToString();
            s2 = urlinfo.Remove(urlinfo.IndexOf("&deep="), 7);
            s2 = s2 + "&deep=1";
        }
        else
        { s2 = urlinfo + "&deep=1"; }

        Response.Redirect(s2);
    }
    protected void LinkButton13_Click(object sender, EventArgs e)
    {
       
        string s2 = "";
        if (urlinfo.IndexOf("&deep=") > 0)
        {
            string s1 = urlinfo.IndexOf("&deep=").ToString();
            s2 = urlinfo.Remove(urlinfo.IndexOf("&deep="), 7);
            s2 = s2 + "&deep=2";
        }
        else
        { s2 = urlinfo + "&deep=2"; }

        Response.Redirect(s2);
    }
  
    protected void LinkButton15_Click(object sender, EventArgs e)
    {
      

        string s2 = "";
        if (urlinfo.IndexOf("&sort=") > 0)
        {
            string s1 = urlinfo.IndexOf("&sort=").ToString();
            s2 = urlinfo.Remove(urlinfo.IndexOf("&sort="), 7);
            s2 = s2 + "&sort=0";
        }
        else
        { s2 = urlinfo + "&sort=0"; }

        Response.Redirect(s2);
    }
    protected void LinkButton16_Click(object sender, EventArgs e)
    {
        string s2 = "";
        if (urlinfo.IndexOf("&sort=") > 0)
        {
            string s1 = urlinfo.IndexOf("&sort=").ToString();
            s2 = urlinfo.Remove(urlinfo.IndexOf("&sort="), 7);
            s2 = s2 + "&sort=1";
        }
        else
        { s2 = urlinfo + "&sort=1"; }

        Response.Redirect(s2);
    }
    protected void LinkButton17_Click(object sender, EventArgs e)
    {
        string s2 = "";
        if (urlinfo.IndexOf("&sort=") > 0)
        {
            string s1 = urlinfo.IndexOf("&sort=").ToString();
            s2 = urlinfo.Remove(urlinfo.IndexOf("&sort="), 7);
            s2 = s2 + "&sort=2";
        }
        else
        { s2 = urlinfo + "&sort=2"; }

        Response.Redirect(s2);
    }
    protected void LinkButton18_Click(object sender, EventArgs e)
    {
        string s2 = "";
        if (urlinfo.IndexOf("&sort=") > 0)
        {
            string s1 = urlinfo.IndexOf("&sort=").ToString();
            s2 = urlinfo.Remove(urlinfo.IndexOf("&sort="), 7);
            s2 = s2 + "&sort=3";
        }
        else
        { s2 = urlinfo + "&sort=3"; }

        Response.Redirect(s2);
    }

一站式全网营销,您身边的网络营销顾问,为您一对一私人定制符合您实际需求的网络营销实施方案!
24小时咨询热线:
150-0382-3679