开发者

ASP.NET partial page update with GET parameters

开发者 https://www.devze.com 2023-01-02 07:14 出处:网络
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 postb

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消