Tutorial :Sharepoint controls in ASP.NET application


Is there a way I can use the sharepoint controls in a ASP.NET web application like any other controls that come out of box for ASP.NET? If yes, what are the pre-requisites I need to install?

Thank you, Harsha


Yes, you can use SharePoint "controls" in an ASP.NET application, as long as the application is running in SharePoint.

In other words, the prerequisite is SharePoint.


Most controls have internal dependencies on SharePoint (i.e. they use SPContext or SPWeb internally). Also, since they are contained within the Sharepoint Assemblies, you can not just take the .dlls and put them in your app.

In short: In most cases, it will be better to re-build them using reflector. Which one are you looking at?


What specific controls are you referring to? Those that you find in SharePoint Designer?

If you are referring to Web Parts in WSS v3, those that are using the ASP.NET Web Part as the base web part (the recommended approach) may work fine in ASP.NET since the Web Part class inherits from Panel which inherits from Web Control (going from memory here) - all ASP.Net classes. It would just depend on whether the web part has any SharePoint specific code which is highly dependent upon the web part.


Host the application in SharePoint's _layouts directory (see this video for more details). Your ASP.NET app will then be "running in SharePoint" and have access to all SharePoint controls.

Note that some controls don't work unless they are running on an actual SharePoint page.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »