Skip navigation.

A Misfiring Postback and How to Fix ItAll recent postsBook Review: Small Giants

A Minimalistic Control Extender

Whenever I try to create a control extender with ASP.NET AJAX, I never get it right at first try even if I follow this tutorial to the letter. My script won’t register, or the client-side class would fail to create, etc. Poking around the latest build of the AJAX toolkit, I figured this much gets an extender going:

[assembly: WebResource ("FooBarExtender.js", "text/javascript")]
namespace MyControls
{
 [TargetControlType (typeof (Control))]
 [RequiredScript (typeof (CommonToolkitScripts))]
 [ToolboxItem (false)]
 [ClientScriptResource (
     "FooNamespace.BarClass", "FooBarExtender.js")]
 public class FooBarExtender : ExtenderControlBase
 {
 }
}

The reason I want CommonToolkitScripts is to have access to Common.js where the CommonToolkitScripts class resides. The class comes with a ton of helpful functionality. You can call its methods via the $common alias.

It’s a pity you can’t just copy and link to this file because of the funky way the class is written. It would come awfully handy in projects other than extenders.

Comments

No comments yet

Emails and Notifications

Would you like to be notified when somebody responds to this post? 

TrackBacks

Sorry, TrackBacks are not allowed.

Submit your comment

Please enter only text since all HTML tags except hyperlinks will be stripped. Hyperlinks will become live links. Any comments with flaming or offensive language will be deleted. Be courteous to other posters. Thank you.

Your name (required):
Your email (optional):
Your site's URL (optional):
Enter this number
Type in the number above:
Comment (required):