ASP.NET partial page update with GET parameters
I have a ASP text box which is acting as a search box. I have set AutoPostBack="True" and a se开发者_JS百科rver side ontextchanged event. The text box is in an update panel to avoid a full page postback. Currently the server event is fired when the text changes, without the page reloading.
For the sake of navigation and bookmarking, I want the URL to change to reflect the search string. e.g. "...MyPage.aspx?s=searchstring"
However, If I put something like this in the server event:
protected void txtMyBox_TextChanged(object sender, EventArgs e)
{
Response.Redirect("~/MyPage.aspx?s="+txtMyBox.Text);
}
The whole page reloads, whereas I only want a small area to be updated. Can I avoid this full reload when the URL is changed?
精彩评论