Geeks With Blogs
Joseph Baggett Scrooge McDuck "Work smarter, not harder"

I was running into an issue with storing javascript as an embedded resource, but had a boolean that needed to maintain it's state.  I originally was using a hiddenfield to maintain the boolean via getElementById b/c javascript gets reloaded from the assembly, causing the boolean to get reset.  The problem is what happens if something dynamically changes your page values, and your script reliant on looking for specific controls becomes null?

A better solution I found was extending controls via ExtenderControl.  You musy override GetScriptReferences which basically points to your script in your assembly and override GetScriptDescriptors in which you can add properties, events, etc. to your extender control that can expose members and events inside of your javascript.  I am able to maintain everything inside of the control without worrying about getElementById or loss of values as it implments ajax. 

I'll do another post showing the details later, but I thought it was a very cool solution everyone should start checking out.

Posted on Wednesday, April 8, 2009 11:19 AM | Back to top


Comments on this post: Extending Controls with ExtenderControl

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © JosephBaggett | Powered by: GeeksWithBlogs.net