Cookies 更新不及时
//获得搜索参数开始
string SearchTypes = DDL_SearchTypes.Text;
string Key = tb_Key.Text.ToString();
if (SearchTypes != " " && Key != " ")
{
intPageNo = 1;
Response.Cookies[ "strc "].Value = "And " + SearchTypes + " Like ' " + '% ' + Key + '% ' + " ' ";
//Session[ "strc "] = "And " + SearchTypes + " Like ' " + '% ' + Key + '% ' + " ' ";
}
//string str_Condition = Session[ "strc "].ToString();
string str_Condition = Request.Cookies[ "strc "].Value.ToString();
//Response.Write(str_c);
Response.Write(str_Condition);
//获得搜索参数结束
每次换关键字搜索要点两次,str_Condition的值才会变,Cookies更新不及时,第一次清寒是显示的老的,第二次才显示新的.
------解决方案--------------------是的,这样解决
string x = "And " + SearchTypes + " Like ' " + '% ' + Key + '% ' + " ' ";
Response.Cookies[ "strc "].Value = x;
string str_Condition = x;
------解决方案--------------------用Session吧