Silverlight in ASP.NET - 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)

Related

What is the difference between ASP .NET Web Forms Applcation and ASP .NET Web Forms Site

I need to write a simple app which will work in a cloud where I can store data about clients and it will be avaiable from Windows and Android and I assume it has to be a website.
What is the difference between ASP .NET Web Forms Applcation and ASP .NET Web Forms Site? Which one should I use?
Web Form Site is nothing more than previously called Website projects where you work with webpages which is just small php like (with Razor/aspx) script files which render as html.
Webform is more like a component oriented framework. Web Form Site or WebSite should only be used for small projects or if the project needs to be compile in C#/VB both language. Also if you want to put your all source code in web-server then it can be used. On contrary with WebForm application you don't need to put code base files to run the projects - you'd be better off only putting scripting .aspx files.
This has been explained in detail in the following question:
ASP.NET Web Site or ASP.NET Web Application?
Also, you can check out the differences between the two here:
MSDN
Regarding your first question if your app is native or hybrid then you need REST(WebApi in .net world) which any app can access natively regardless of the device and will meet your needs of the "cloud".
If you what you want is a website instead that is "viewable" by mobile devices you may want to make your website "responsive" and you can look at various bootstraps templates that can help you with that.
Regarding your second question I think it has no bearing nor it will make any difference in creating a mobile app which project type you use.

MVC app inside WebForm app

I have an ASP.Net website built in .net 3.5. When clicking on one of the aspx page, I want to open an MVC appliation inside that page. MVC app is developed by another company. What is the best way of doing that?
Scott Hanselman's Article doesn't include this scenario I guess.
It depends on what kind of interaction you are expecting between your app and the externally developed app. If the UI isn't going to interact between them then an iframe is probably what you're looking for. If it is going to interact then you can interact between them using exposes apis or web services on both sides.

Creating an AJAX-Enabled Web Site

I'am trying to follow an ASP.NET with AJAX Training. At certain moment, they deploy an AJAX-Enabled Web Site. but for me I can't found this option (I'm using Visual Studio 2008).
Even if I installed the Ajax Control Toolkit it still not working for me !!
What must I do to find this ?
Even if you can't find the template, you can still do everything the training kit needs.
The only difference between an ASP.NET web project and an AJAX-enabled ASP.NET web project is that it takes care of a few pre-requisites for you:
1) It adds a reference to the Ajax control toolkit. You can do this manually by right-clicking on your project in the Solution Explorer, choosing "Add Reference", and navigating to the AjaxControlToolkit DLL (or find it in under the .NET tab, if you've added it to the GAC).
2) It adds a ScriptManager control to your aspx page. It comes with the Ajax Control Toolkit. The ScriptManager is required to use any of the AJAX Control Toolkit controls. Add it to the top of your page.
If you take care of those two things, you should be good to go - it's the same thing as using the Ajax-enabled website template.
I have an issue in 2nd step. As i am using update panel and there is already a ScriptManager in master page, so I am using ScriptManagerProxy in updatepanel.
So when i start adding "ToolkitScriptManager" it shows error "Two scriptmanager" instances are not possible in one page...
Manish Jain

SharePoint Webpart and ASP.NET User Control

I am developing SharePoint Web Parts for MOSS 2007 on Visual Studio 2008. Up until now, I've been adding all my controls by hand to the code behind... but an earlier post suggested I could use the designer to create an ASP.NET User Control, then add it to the webpart, and everything is happy... See figure 5 for an example.
However, I can't seem to add a new ASP.NET User Control to my MOSS WebPart project, the template just doesn't appear. If I create a WebApplication and make my User Control in there, I can't see any SharePoint templates to add to the project. Finally, I tried copying a simple aspx file and its code behind to my webpart directly, and adding them as an "existing component"... but now the designer won't recognize the aspx file. Next, I'd probably try adding two projects to my solution, and just referencing any dll's from the ASP.NET application...
So how do I get an ASP control into my SharePoint WebPart project so that I can use the Visual Studio designer?
Edit: So here is a partial solution where the ProjectTypeGuids needs to be modified. When I try this, it gives me an error saying "The project type is not supported by this installation". I am using Visual Studio 2008.
Try reading some of the following tutorials:
http://www.google.com/search?q=create+sharepoint+web+part+as+feature
What type of functionality and/or display are you trying to create? You may not even need a user control. For example, create a very simple "proof of concept" HTML table as a custom Web control (Web Part). Create it as a Feature and use the Solution Framework to deploy it:
Create a Web Part with VSeWSS 1.3 - Part I
Create a Web Part with VSeWSS 1.3 - Part II
Scott Guthrie offers up resources here on Web Parts and User Controls:
Writing Custom Web Parts for SharePoint 2007

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.

Resources