Using Web User Controls in MOSS

Posted Thursday, May 31, 2007 10:15 AM by C-Dog's .NET Tip of the Day

In the past, to build a web part control in MOSS, you had no choice but to build a custom control inside a class library. That of course sucks because there is no design time support. Let's face it building complex composite controls using C# is a bad time. Well luckily, now there is something called Return of the SmartPart (not to be confused with CAB SmartParts). This nifty web part allows you to load any user control inside of a MOSS web part. On top of that, there is even one with ASP.NET AJAX support which automatically loads the necessry script manager.

Installation is pretty easy. Just follow the steps in the included document. Once installed you will be able to select it from the web part gallery. Then you just configure the properties to load the control that you want. One thing to note is that the SmartPart requires that the controls be located in a folder called UserControls off of the root. If the folder is not there, it throws an exception. A minor annoyance, but with the functionality it brings, that is tolerable.

So next time you need to build something in SharePoint go grab this and give it a try. Microsoft also plans on implmeneting something of their own, but now that this somebody else did the work for them, I don't think they are in a real hurry to do so.

Return of the SmartPart

Read the complete post at http://www.dotnettipoftheday.com/blog.aspx?id=360