Sharepoint controls in ASP.NET application - asp.net

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.

Related

ASP.Net Controls in Delphi

I'm sure this question has been asked already but I couldn't find any posts.
Is it possible to use an ASP.net control in Delphi 2006 for Win32? We have some Dev Express ASP.Net visual controls (Chart controls to be exact) that we would like to use in our Delphi application.
Is this possible and how could it be done, preferably without the need to purchase more third party components.
Thank you.
you cannot use this kind of controls directly in a Delphi Win32 Application, because this components are designed to run in a web server with ASP and expose the results to a browser client, i think which your best option is use a local (or remote) web server and make a web page which accepts HTTP requests, and then in TWebBrowser in your Delphi Win32 app load the page to get results.
That is not going to be possible as the DevExpress ASP.NET controls are wired up via handlers in the web.config and not something that can be forced into Delphi. I assume you have looked at DevExpress's VCL controls for (Delphi and C++ Builder Controls) on it's website? If the VCL product suite does not have what you need then you will need to look elsewhere.

Sharepoint WebPart

I'm new to developing in SharePoint and would like some tips please. I want to develop a WebPart. I understand that I effectively need to do this on a machine with SharePoint Server installed and create the web part as an ASP control. Once the control is created, how do I link it into SharePoint?
I would recommend you to take a look at the WSP Builder extensions for Visual Studio. It will simplify the development and deployment process for you, since it contains both templates for web parts, features and it will also package it up in a WSP solution for you.
I would read though this:
http://msdn.microsoft.com/en-us/library/ms452873.aspx
It will answer a lot of your questions about creating a web part, deploying etc.
If you're using the Microsoft Provided WebPart Visual Studio template...it will automatically be deployed to your site when you build it.
If you need to deploy to a test/production environment, you need to create a SharePoint Feature and then deploy the Feature to the server.
http://www.allaboutmoss.com/index.php/2010/03/22/hello-world-sharepoint-webpart-for-beginners/ helps you to create simple webpart and shows how it deploy in server.
You are able to build Web Parts in a number of different ways, through Visual Studio .NET using either the SharePoint Web Part Namespace or the normal ASP.NET Web Part Namespace further you are able to build Web Parts in SharePoint Designer using a combination of different technologies, such as XML Web Services.
XML Web Services will allow you to hook directly into SharePoint using SharePoint's Native Web Services, you can then create a Data View Web Part which will enable you to view, collate, filter and group List Items. This, of course, will also allow you to mingle normal HTML as well as XSLT syntax, allowing you to build logic into the Web Part.
The good thing about doing it this way is there is no "real' coding, i.e. no Code Behind page etc as there would normally be in ASP.NET. This also allows you keep things more or less SharePoint Centric, which is important because you may or may not have access to Central Admin or SSP nor indeed the Server itself, the 12 hive or the GAC.
How you decide to develop Web Parts should include thinking about all of the above, you may have a very restricted development environment. Further, you can also use Namespaces provided directly from GAC assemblies provided by Sharepoint, you may either need access to a development environment which has a MOSS or WSS Server on it or the PIA's or Assemblies from a MOSS/WSS Server.
I am a software developer, however, it is important for me to develop applications which are as SharePoint centric as they can be, which is why I decided to develop my Web Parts in SharePoint Designer. However, there have been times when using full VS.NET is the way to go, I would suggest you look at SharePoint Designer first, get a feel for the interface, XML Web Services, XSLT and HTML once you have created a SharePoint Designer Web Part and Provided this Web Part exists within a Web Part Zone, you can export the Web Part and reimport it into any number of Site Collections.
I must add that the above relates to SharePoint Lists and Libraries but it gives you a grounding to understand how it all fits together. it helped me understand more and made development of more coded Web Parts easier, It may not suit your individual requirements, SharePoint is a huge environment offering many paths.
Hope this Helps you out, search for SharePoint Designer... at least as a starting point.
Cheers

Integrating SharePoint document libraries into an ASP.NET page

Is there any way that I can use SharePoint document library and document sharing functionality from an ASP.NET page?
There's 3 ways you can have your standalone ASP.NET (standalone meaning not integrated into sharepoint) interact with sharepoint.
1 using the SharePoint object model (sharepoint APi dll's). This way allows you to control every part of how your ASP.NET site interacts with SharePoint (document security etc.) The major drawback is that you ASP.NET site needs to be running on the SAME SERVER as SharePoint (or if sharepoint is used in a farm any machine that is running sharepoint in that farm). Simply including the SharePoint DLL's will NOT work when run on any other machine (even when that machine also has sharepoint installed but is not part of the farm you want to communicate with!)
2 Web Services. These OOTB services can be used from anywhere but are not very extensive functionality wise. They allow you to perform a lot of actions and retrieve a lot of data, but when it comes to more finegrained control they just don't cut it. It might be enough for what you want to do though.
3 Use web services and create your own webservice that is deployed to sharepoint for any tasks not doable with the OOTB services. This requires access to the sharepoint machine in the form of deploying custom code / assemblies though.
I assume that your asp.net application is running on another server because if thats not the case the it would probably be easiest to just use the SharePoint functionality directly and maybe include your app into SharePoint
SharePoint exposes a lot of it's functionality through Web Services, so you can get, add, delete and update information through these.
You can include any SharePoint page into a page in another portal using an IFrame. The main issue there is the fact that you will get the MOSS navigation in that IFrame, which typically is not desired. To overcome that, you can create a special MOSS page that hides all those elements and show just the element you want to expose. To accomplish that, you can create a “minimal” master page and a simple layout with a single web part zone.

ASP.NET Sharing a user control/web page logic with multiple web applications

I have a web application, which has a user control and web page logic to be used on multiple web applications. The reason I want to do this is that I want the other web applications to reference this one since the html/css of their web pages varies.
First of all I wanted to ask if this is possible since it is a web application and not a class library.
Secondly if it is possible how do I refrence the web page logic to the htmls of the other web applications?
How about adding the Web User Control to a Class Library and referencing that Class Library from the website ?
Here are instructions by Haacked on how to add a User Control to a Class Library: http://haacked.com/archive/2006/02/07/AddingWebUserControlToAClassLibraryInVS.NET2005.aspx
Also here is a post by Guthrie about Building Re-Usable ASP.NET User Control and Page Libraries with VS 2005 and I think it's worth a look.
[Update]
I found a better tutorial on Creating and Using User Control Libraries. I think that this article is more concise than the other one by Guthrie (also this one is also by Guthrie)
Compile and deploy your asp.net website which will produce one assembly per code-behind.
Pick the assembly of the code-behind class you want to re-use and drop it into the \bin folder of your 2nd web-app in which you want to reuse it.
Now this assembly will have a partial class which you can merge with the code-behind of an existing web-page. Just ensure the naming hierarchy are matching.

Silverlight in ASP.NET

Duplicate:
How do I use Silverlight from ASP.NET?
How do I add some Silverlight content to an already created ASP.NET website?
Add a new Silverlight application to your existing solution. Here's an MSDN article which shows how to integrate it with your existing website, so building the Silverlight application will deploy the Silverlight control to your ASP.NET website's Client_Bin folder.
To add a Silverlight control to a webpage in your site, you can reference the Silverlight test page that's automatically created for you, or you can use the ASP:Silverlight control, which will take care of loading the Silverlight object.
You only need to copy the XAP file to your site and reference it.
When you create a blank SL project you get the boiler plate code for the ASp .net site for free.
Having an ASP .net 3.5 SP1 enabled site, you can asp:Silverlight control:
Going without any ASP .net sugar control (you can use it on ie an php page), you can use an Object intance inside a div:
Soirry tried to paste code samples but didn't work well :-(.
Microsoft does not recommend using the ASP:Silverlight control as of Silverlight 3.
There's a great article at MSDN about how to include Silverlight using the <object> tag, or using the silverlight.js library: Integrating Silverlight with a Web Page. This helped clear up a lot of confusion for me.
This makes it much easier to provide a more customized experience that fits in better with the rest of your application.
(There's also a decent article explaining how to interact with the Silverlight control once it's embedded in your page: HTML Bridge: Interaction Between HTML and Managed Code)

Resources