I have the pleasure and slight pain of playing with web parts in Whidbey
a little over the last few days and here are some initial observations.
-
Web Parts are cool. They seem to work as expected for the most
part are easily implemented. -
The implementation does have a little way to go. The requirement
of including a WebPartManager on your page is just plain hokey. The inclusion
of one or more WebPartZones should automatically include a WebPartManager if one is
needed. -
WebParts do not extend or in any way relate to UserControls. This
sucks. What it means is that to implement web parts today, you have 2 choices. -
Drop a UserControl into a WebZone. Taadaa, instant WebPart.
This would be OK, except for the fact that you cannot access some of the intrinsic
members of the WebPart class, like the Title property. In an even hokier move,
you can provide a Title property on your UserControl and the WebPartZone will look
for it and pretend that it is a WebPart. There is no Interface declaring it, you just
kinda have to know that. Weird. -
Derive a new class from WebPart and implement all of your UI code in
the class file. Yep, that’s right. Using this technique, I can find no
discernible way to separate my code into a mark up representation and a code-behind
file. This has GOT to be fixed before this stuff goes production. No way
am I willing to take that step backward.
My understanding is that MS has plans to change the WebParts implementation
dramatically before VS 2005, so I am not too concerned about these latter points.
After all, I am working with Beta software here. I am sure the MS code gnomes
are looking at these things.