Page losing title after UpdatePanel asyncpostback

前端 未结 6 1323
时光取名叫无心
时光取名叫无心 2021-02-13 02:45

I have just noticed recently that my page title will reset to the standard \"Untitled Page\" after I perform an asyncpostback from inside my UpdatePanel in the main

6条回答
  •  忘掉有多难
    2021-02-13 03:25

    We ran into this exact issue on one of our sites.

    The immediate fix was to reset the title in the master page codebehind page_load method.

    Apparently when the ajax call occurs, it is rerunning the master page. This was causing our title to disappear.

    For example:

    protected void Page_Load(object sender, EventArgs e) {
        this.Page.Title = "whatever title you have...";
    }
    

    A better fix is to drop the MS updatepanel crap and start using JSON / jQuery where you actually have some decent control over the calls.

提交回复
热议问题