Sunday, 21 December 2014

Radio Button Inside Update Panel Does Not Postback Always!

Hey Friends - Sitecore Journey is about to complete ONE SUCCESSFUL YEAR of blogging!!!
How about your Sitecore Journey?

Recently while working on last release of project, I came across a situation which made me write to this post. I am sure this will help you in your Journey.

We were adding ScriptManager at run-time by checking whether any scriptmanger already exists on page or not. The reason is .NET Framework will not allow you multiple scriptmanager on the same page. We were able to manage this perfectly fine.

But one of our pages where we were using radio button inside updatepanel stared behaving differently in above implementation (adding ScriptManager at run-time). Clicking on radio button sometimes postback and sometimes NOT!!!

We found that we need to explicitly register our radio button control with ScriptManager for asynchronous post-back as highlighted in below code.

If you are looking for solution to add ScriptManager at runtime by checking whether any scriptmanager exists on any page or not, then you can create placeholder to add scriptmanage at runtime and write code in "Initialize" method of placeholder as explained in below screen.
Thanks to Kiran and Vikram for their help who were involved in this solution!

Merry Christmas and Wish You A Happy New Sitecore Year!!!