Surendra Sharma

Surendra Sharma

Search This Blog

Tuesday, May 5, 2015

Page title is changing on partial postback

I have three dropdown list on my page for country, state and city. All these 3 dropdown list are in update panel so that I can use partial rendering features of AJAX. Its working fine. All 3 dropdown list are working great and I was feeling proud that I implemented it.

But fuck to my tester who find out issue related with these dropdown list as well. He has eagle eyes. Whenever he selected any of these 3 dropdown list, my webpage title changed to current URL of the page.

I debugged my code from start to end but unable to find out the reason? Why?

But fortunately its work around is just to set the page title again in the end of page load event as below.

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                    //Some code here;
            }
            else
            {
                    Page.Title = "This is page title";
            }
}

Let me know if you have any better solution or particular reason of this behavior.

Please leave your comments or share this code if it’s useful for you.

No comments:

Post a Comment