SmartPart Version 1.1: Alive and Kicking!
I know I promised the new version of the SmartPart for this weekend, but minutes before I wanted to upload the bits to GotDotNet Workspace I found a small issue. It took me some time to find the bug, but now I’m proud to present to you the SmartPart version 1.1! Before you all start downloading the latest version, here’s an overview of the new features:
Support for Custom ToolParts
If you develop web parts the hard traditional way, you probably know that you can create custom tool parts for your web parts. These tool parts will show up on the right hand side when you click “Modify Shared Web Part” in the same area where you can modify default web part properties like Title, Width, etc. Now you can create User Controls which can provide Custom Toolparts, just like the “real” web parts. If you download the latest release from the GotDotNet site, you will find an example of this technique. It comes down to this: if you implement the SmartPart.IAdvancedUserControl interface, you will have a function that can return an array of toolparts which will be shown by SharePoint.
Access to the underlying web part instance
Now it’s possible to access the web part that hosts your user control. So it will be possible to get or set properties of that web part from your user control. In the latest release you will find an example that can change the web part title from code.
“Hidden” custom properties
In the previous version of the SmartPart, the only way to persist a value was to implement a public property and decorate it with the Browsable attribute. The side effect was that this property would show up in the web part’s tool part so user could access it. In many cases this is the desired behavior, and this is also applicable to the new version of the SmartPart. But suppose that you’d like to persist a value that shouldn’t be available for the user. Now you can easily get or set values for a property that will not be exposed to the user by using the GetCustomProperty and SetCustomProperty functions of the smart part web part instance.
Various minor improvements
Some minor changes are made to the code to improve performance and behavior of the SmartPart.
Backward compatibility
All the interfaces used in the previous version of the SmartPart are left untouched, so theoretically you should be able to upgrade your user controls without having to change anything to your code. If you want to make use of the new version, you have to use the new SmartPart.IAdvancedWebPart interface.
I’m planning to record some short webcasts to illustrate how you can use the SmartPart. The first episode is about the installation, and you can find it over here. Maybe there are some people that want to share their experiences with the SmartPart or talk about the projects in which they have used it. It would be totally cool if we could to some sort of podcast about the SmartPart success stories, if you’re interested, drop me a line and we’ll arrange a Skype session.