Thursday, March 17, 2005

.NET: Conjecture on UserControls

I have become fond of the Web UserControls in .NET. They are undoubtedly clunky in their injection of strange namespaces and tags into your .ASPX file but the promise for easily reused HTML is awesome. What remains to be understood is how far these controls can be pushed with validation and client-side scripting. Clearly it can be hacked in there, but if MS facilitates easy ways of catching and acting upon postbacks & validation failures on an ASCX (UserControl) file, it opens up a world of possibilities beyond HTML reuse. For example:

Let's say you make CustomDateControl which pulls in a date field. If the framework is bright enough, you could assign a valid date range to said control. Upon validation, control would push back and inform the user "outside of range". One step further: client side validation could push back even before the postback is made.

This touches on another subject mentioned in previous blogs. Validation. I am fond of and old Java-style method of error reporting, the Observable/Observer interface. If a web control could pulse a message like this, then another listening control could grab it and display messages appropriately. Again, if there is a transparent client-side mechanism to do this, then the possibilties are impressive.

0 Comments:

Post a Comment

<< Home