Mimeo’s Initial Migration/Implementation of ASP.NET AJAX Completed

We just launched the first version of the site where we depend completely on ASP.NET AJAX to do all our script management. Here’s what we did in this initial phase:

All in all the experience was very smooth. There is one snag to using UpdatePanels that bit us though. If you have controls that normally include their own <link>s to stylesheets by adding them to the <head> via the HtmlHead control, if those controls are dynamically loaded into an UpdatePanel during an async-postback those stylesheets will not arrive at the client and your controls will not render appropriately. This is because ASP.NET AJAX doesn’t handle the <head> content changes when returning an async-postback response. I can find no way to overcome this at this point using ASP.NET AJAX.

I therefore began writing my own StyleSheetManager class which is akin to ScriptManager. The idea would be that in the case of an async-postback, the StyleSheetManager server-side class would emit a startup-script (via ScriptManager::RegisterStartupScript) that is an Array of URLs that need to be loaded. That would be passed to a client-side function that would essentially make calls to dynamically add <link> elements to the <head> with the various style sheet URLs. I’m hoping this will work cross-browser, but I have yet to find the time to finish and fully the control. When I do, I’ll be sure to post my findings and maybe even the code.

In all, I’m extremely pleased with ASP.NET AJAX. In the next phase of ASP.NET AJAX migration for this project we have the following planned:

  • Convert all client-side components/controls to the ASP.NET AJAX class/component/control model (i.e. properties, standard prototype approach, member variable naming with underscore prefix, namespaces, type registration, etc.)
  • Replace proprietary eventing model with ASP.NET AJAX event model
  • Replace proprietary client side resourcing model with ASP.NET AJAX resourcing support
  • Replace all custom parsing/formatting functions for dates/numbers/etc. with built in ASP.NET AJAX globalization
  • Replace proprietary debug calls with Sys.Debug
  • Replace proprietary focusing logic with ScriptManager.SetFocus

We’ve also begun a new, separate project which is being built from the ground up to be 100% ASP.NET AJAX based. When that’s done, it’s going to be a a great showcase for what’s possible with this technology!

Leave a Reply