Tutorial :Sharepoint controls in ASP.NET application



Question:

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


Solution:1

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.


Solution:2

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?


Solution:3

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.


Solution:4

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
Previous
Next Post »