Finally I’ve managed to finish a new release for the SmartPart for SharePoint; version 126.96.36.199. This release has some really cool new features, but I'm really excited about the first one: connectable web parts with ASP.NET user controls!
- Create connectable web parts
In SharePoint you can connect web parts, so they can exchange data. For example you could create a web part that displays a list of invoices, and another web part that displays the details of the selected invoice (master/detail view). Normally you’d have to create your Invoice and InvoiceDetails web parts by hand, implementing the ICellProvider and ICellConsumer interfaces (see Patrick’s excellent article about this topic). With the new version of the SmartPart you can do the same, but instead of coding everything by hand, you can create ASP.NET user controls! Just implement the ICellProviderUserControl or ICellConsumerUserControl on your user control, and you’re done.
- CAS Optimization
Maxim Karpov did a great job on fine-tuning the Code Access Security for the SmartPart. For running the previous versions of the SmartPart, you’d had to increase the trust level in the web.config to WSS_Medium. In this version this is not required anymore. Of course if your user controls require a higher trust level, you can raise the trust level as usual.
- Hiding the user control selection
Once you’re finished building your user controls, maybe you’d want to ship the finished web parts/user controls to a customer for example. In that case you don’t want the user to select the user controls from the dropdown listbox of the SmartPart, or filling out the user control name by hand. With the new version of the SmartPart you can create a DWP file which contains all the settings for an instance of the SmartPart showing a specific user control. The nice part is that you can hide the dropdown listbox or textbox for selecting the user control by adding the following node in the DWP after you’ve exported an instance of the SmarPart: <ShowUserControlList xmlns="SmartPart">false</ShowUserControlList>.
You can download the latest version from the Releases section on the GotDotNet Workspace. In the coming days I’ll create an example for each of the new features. Additionally keep an eye on Maxim’s blog, he has promised a post about the CAS issues. Also make sure you’ve read Readme file before deploying the SmartPart, since you now have two deployment scenarios (in the GAC or not). Of course if you have any comments, problems, questions, … let me know!