public virtual void QueryBtn_Click(object sender, EventArgs e) { var btn = (LinkButton)sender; string query = String.Empty; var condition = new Dictionary <string, string>() { { "StartDateTime", ((TextBox)btn.Parent.FindControl("StartDateTime")).Text }, { "EndDateTime", ((TextBox)btn.Parent.FindControl("EndDateTime")).Text } }; query = WebUtils.ConstructQuerytString(condition, Request); //查詢後 pageIndex 必為 1 query = Regex.Replace(query, @"pageIndex=\d+", "pageIndex=1"); string url = Request.Url.LocalPath; Response.Redirect(String.Concat(url, query)); }