Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Web Control Enhancements in ASP.NET 2.0

ASP.NET 2.0 does not break any existing controls from 1.1, but it adds a whole bunch of new ones, as well as several new technologies for control development.


advertisement
'm sure by now you've read more than your share of books and articles describing new ASP.NET 2.0 features. Master pages, themes, providers, etc., are all great, but have you read anything regarding what's changed with custom Web control development? Well that's what I'm here to tell you. If you've become involved in control development, either through my articles or on your own, I'll describe some very cool enhancements that you can put to work right away in your controls using ASP.NET 2.0.

Ok, so before you misinterpret the title of this article or make any false assumptions about code compatibility, let me start by telling you that all of the Web controls you developed in ASP.NET 1.1 (or 1.0) will work just fine in 2.0. Feel better? Good. Microsoft has not changed anything that will break your existing code. Everything that I will teach you here involves new and exciting technologies that you can add to existing controls or use with new ones.

Author's Note: This article assumes a basic knowledge of custom Web control development as explained in my two-part article series, "Custom Web Controls Demystified" published in the Sept/Oct 2005 and Nov/Dec 2005 issues of CoDe Magazine. In this article, I'll enhance the EmailContact control described in the second part of that article. If you have not read the previous articles, I strongly recommend that you do so in order to familiarize yourself with this control. If you're a seasoned Web control developer, you should have no trouble following along.

New Enhancements
Table 1 describes several of the most important enhancements for custom Web control development. These are the ones I will cover in this article, but if you choose to research this topic further, you'll find that there are several other changes and enhancements in the Web control arena, including Control Adapters, several base classes, region editing, and others. Perhaps I will make some of them the topics of future articles.

Table 1: ASP.NET 2.0 Web control enhancements.

Enhancement

Description



New Base Classes

ASP.NET 2.0 introduces a few new base classes from which to derive your controls. I'm going to brief you on the most important one, CompositeControl, and how it can save you grief that you've all dealt with in the past.

ControlState

A cousin to the familiar ViewState, ControlState eliminates the all-or-nothing approach to state management and allows you to avoid pitfalls in the case that the control user turns off state management in a site (or page).

Smart Tags

Windows control developers rejoice! This enhancement is good for you too! You know that popup window that opens up on the design surface when you click on that new doohickey in the upper right-hand corner of a control? I'm going to show you how to create one for your own controls.

Template Design-time Editing

Adding design-time editing capability to control templates in 1.1 was an immense hassle. Luckily, ASP.NET 2.0 makes adding this functionality incredibly easy. I included this topic in last issue's, "Web Control Templates Explained," but I will cover the editing-specific details again.

Auto Format

This enhancement is awesome! You've seen how you can choose from a list of predetermined formats on the good ol' DataGrid control. ASP.NET 2.0 makes giving your own controls this ability easy; it's almost a shame not to do it for all of your controls.

Web Resources

This is one of my favorite enhancements since I'm always developing controls that rely on images here and there. In ASP.NET 2.0 you can now deploy a control's DLL and nothing else. That's right—you can now embed images and other resources into the control's DLL file. Think of this as a poor man's linker.




Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap