Partager via


Installing SmartPart for Sharepoint (with a dash of WCF) 1 of 2

It's a friday afternoon and I've just spent the better part of the day banging my head against SharePoint, so in a break from tradition I've decided to blog about how I got it working.

For those who don't know, SmartPart is a funky little Web Part for SharePoint. It allows lazy people (such as myself) to develop ASP.NET user controls with Visual Studio's WYSIWYG editor and then wrap them up as though they were a true orthodox WebPart. As I'm sure you're all aware, web parts are in actuality custom controls which require the developer to write code to output the presentational HTML, so SmartPart can save you a gret deal of time and effort.

1) So firstly, download SmartPart from codeplex.com/smartpart

2) Run the installer which checks you have WSS and all that jazz

3) Stick the SmartPart assembly in the GAC (c:\windows\assembly)

4) Activate the feature to your chosen site collection

5) Edit a test page and add a web part

6) Select Smart Part from the web part gallery dialogue you're presented with

Now you may be luckier than I, but at this point for the me SharePoint fell over and complained that the SmartPart webpart was not trusted. So you have to go into the web.config for your website and add the SmartPart.dll as a SafeControl.

      <SafeControl Assembly="ReturnOfSmartPart, Version=1.3.0.0, Culture=neutral, PublicKeyToken=9f4da00116c38ec5" Namespace="SmartPart" TypeName="*" Safe="True" AllowRemoteDesigner="True" />
 

7) Try to add the SmartPart webpart again and this time it should work.

8) Next add two dirctories to your website; UserControls and Bin. The former is where your ASCX user controls (and their code-behind) will reside, and the latter is where the corresponding user control assembly will sit (if you have any classes/interfaces which are not control code files, for example WCF proxies).

9) Now you should be in a state where you can put user control ASCXs etc on your website and SmartPart can find them.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

In my next blog I will explain some of subtlteties involved in calling a WCF service from within the SmartPart webpart. Hope this was of use to someone.

Comments