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.

23 Comments

  • can't wait to have ago with this new release.

  • Hi Jan,



    Good idea to webcast the installation procedure. Although it's not that difficult, it's always useful to see someone else demoing the steps.



    Cheers,

    //Rutger

  • Great, very good idea the webcasts.

    Carlos.

  • Hi Jan,

    this is a great web part, i use this in my project since v1.0. But now, I got a trouble. i used smartpart to load my usercontrol in my develop computer, that's runs great. But when I use it in production computer, i got an error after select a usercontrol and click "apply" button. this's the error message i got below:



    The "UserControlWebpart" Web Part appears to be causing a problem.



    Web Parts Maintenance Page: If you have permission, you can use this page to temporarily disable Web Parts or remove personal settings. For more information, contact your site administrator.



    Can give me a help?

    thanks.



  • Thanks, can't wait to try it out - SmartPart 1.0.0.0 has already made life easier (for me, anyway!) :) I concur...the installation webcast is a good idea, any clue what the next webcasts will involve yet?

  • I’d only been playing around with Sharepoint for a few weeks when I found about smartpart. I just turned a small database web application into a user control. I was using session to persist some data, but switched it to use webpart.SetCustomProperty and webpart.GetCustomProperty and it has worked out great. Smartpart is awesome.


  • Hello,

    Has anyone successfully created a ToolPart for a SmartPart? I cannot find a single example after hours of searching. I've tried numerous things, all which lead to a dead-end. For instance, when creating the ToolPart, in the RenderToolPart and ApplyChanges events, you will need to set a custom attribute on SelectedWebPart. This means you have to cast the web part to your custom class that inherits from WebPart. Since we are actually creating a UserControl which implements the IAdvancedUserControl (poor naming - why not ISmartPart or IUserControlWebPart? It's not really an "Advanced" anything, IMHO, just another extension like any other), there is no way to cast the web part to the smart part.

    Should I create a class which inherits from UserControlWebPart for each SmartPart that needs custom ToolParts, and use the UserControlWebPart set in the SetContext event to access it? Can I even do this without the source code for the Web
    Part, or without re-engineering that whole SetContext event?

    Thanks,

    Tim


  • Hello,

    Has anyone successfully created a ToolPart for a SmartPart? I cannot find a single example after hours of searching. I've tried numerous things, all which lead to a dead-end. For instance, when creating the ToolPart, in the RenderToolPart and ApplyChanges events, you will need to set a custom attribute on SelectedWebPart. This means you have to cast the web part to your custom class that inherits from WebPart. Since we are actually creating a UserControl which implements the IAdvancedUserControl (poor naming - why not ISmartPart or IUserControlWebPart? It's not really an "Advanced" anything, IMHO, just another extension like any other), there is no way to cast the web part to the smart part.

    Should I create a class which inherits from UserControlWebPart for each SmartPart that needs custom ToolParts, and use the UserControlWebPart set in the SetContext event to access it? Can I even do this without the source code for the Web
    Part, or without re-engineering that whole SetContext event?

    Thanks,

    Tim

  • I have the same problem of creating a custom toolpart using SmartPart. Did you have any luck?

  • I'm new in this project, maybe it could help me!

  • I get this error when trying to use the DropDownList Example.

    The "UserControlWebpart" Web Part appears to be causing a problem.

    Web Parts Maintenance Page: If you have permission, you can use this page to temporarily disable Web Parts or remove personal settings. For more information, contact your site administrator.

    Anyone can offer some help?

  • Installation problem: Are there any experiences with an installation on a 64-Bit Machine (Windows Server 2003, SharePoint with SP2 running under .NET 2.0, web.config correctly modified)?
    The SonOfSmartPart.dll appears in the GAC, but all SharePoint-Sites return the Error "File or assembly name SonOfSmartPart or one of its dependencies was not found."

  • Did anyone ever receive an example of creating a custom toolpart property with the "Return of SmartPart" version? I need one as well.

  • What a rubbisg website this is !!
    you should not do or make the things work in this way

  • Iam trying to diasplay weather in my share point home page.Can any one done this before .

    My requirement is as follows :

    Input : Enter a "Zip code" in to a textbox.

    Output : After submitting, Weather(temperature) should be displayed for the zip code which I entered in the text box.

    Can you please guide me how can this done from the scratch.

    You can have a look at this site, This is the one iam looking to display in my SharePoint home page.

    www.weather.com


    Thanks in advance.

  • This is really fresh idea of the design of the site! I seldom met such in Internet. I will visit your website again. Good Work dude!

  • Hellojmq - this is just a testing, don't worry about it

  • Hellorlj - this is just a testing, don't worry about it

  • As GotDotNet is no longer alive and kicking is it possible to post the samples of using custom toolparts with the smartpart, or point me in a direction where I can see how the code should look.

    Can't see any sample code for this in the latest ReturnOfSmartPart.

    Thanks.
    Martin

  • i, just like therest of you - am also looking for an example to implement a custom toolpart control - could some1 please create a small example for us. pretty please. I motivated my company to use smart parts and now i am stuck.

  • Hallo,

    Can someone post any kind of ToolPart implementation example of the SmartPart. SmartPart is a great thing for any kind of Webpart, but I really need custom propertys that will be adjustable in the ToolPart not just Hidden Custom Propertys.


    PLEASE ANY KIND OF HELP/HINT IS VERY HELPFULL.

    Dejan.

  • I have visited your site 610-times

  • I could not find this site in the Search Engines index

Comments have been disabled for this content.