Page losing title after UpdatePanel asyncpostback

前端 未结 6 1322
时光取名叫无心
时光取名叫无心 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:36

    Rather than change your server side code, why not just fix it in JS:

    $(function(){
        var prm = Sys.WebForms.PageRequestManager.getInstance();
        if (!(prm)) return;
        document.orginalTitle=document.title;
        prm.add_endRequest(function(s, e){
            if (document.title.replace(/\s/g,"").length==0)
                document.title=document.orginalTitle;
            });
    });
    

提交回复
热议问题