Wednesday, March 30, 2005 - Posts

ASP.NET User Controls in Sharepoint WebParts

Sharepoint web templates are available for VS.NET 2003 to develop Sharepoint webparts using ASP.NET. Though these templates provides framework for developing web parts, it didnt provide any support for developing user interface. This approach is similar to developing custom server control. i.e. if you want to place any controls inside the web part, You cant drag and drop controls from toolbox as you do in user control. You need to programmatically declare that control inside the template, everything needs to be done at runtime.

This problem can be solved by using SmartPart web part. This allows you to host any user control inside the web part. So you need not spend time in developing web part using web template. You can use the existing user controls in your application or you can develop new user control and place it inside this web part. Developing user control is much simpler than developing  webpart using web part template.

This article explains how to use SmartPart webpart to host the user control,

http://www.microsoft.com/belux/nl/msdn/community/columns/u2u/smartpart.mspx

This control will surely reduce your web part development.

In ASP.NET 2.0, this feature is supported out of the box. GenericWebPart control in ASP.NET 2.0 takes care of this plumbing work. To know about ASP.NET 2.0 web parts framework, read this article  

with 0 Comments