按标题或内容搜索

xiaoxiao2026-04-11  7

 //搜索按钮    protected void Ibtnsearch_Click(object sender, ImageClickEventArgs e)    {        string key = Textkey.Text.Trim();        string action = Radtitle.Checked ? "bytitle" : "byconent";        Response.Redirect("~/Searchers.aspx?key="+Server.UrlEncode( key)+"&action="+action);    }

 

 

 

 

 protected void Page_Load(object sender, EventArgs e)    {        if (!Page.IsPostBack)        {            string key = Request.QueryString["key"];            string action =Server.UrlDecode( Request.QueryString["action"]);            if ("bytitle" == action)            {                gvsearch.DataSource = new NewsBLL().Selectbytitle(key);                gvsearch.DataBind();            }            else {                gvsearch.DataSource = new NewsBLL().Selectbycontent(key);                gvsearch.DataBind();            }        }

          }

转载请注明原文地址: https://www.6miu.com/read-5047185.html

最新回复(0)