I need to create a web application with silverlight controls how to create this in ASP.net 2.0 with VS 2005.
Help me out
-
Also see this previous SO question:Good resource for learning Silverlight 2 Development?
-
You won't be able to develop silverlight control projects in VS 2005. Additionaly you can't use the new Silverlight webcontrol in Vs2005 or on ASP.NET 2.0 since it depends on 3.5.
Hence you should copy the XAPs and/or XAMLs created elsewhere into your project and treat them simply as content files (place XAPs in 'clientbin' folder). You will need to follow the instructions for using silverlight in simple HTML files in your ASPX.
What I've done is create my own simple WebControl for ASP.NET 2.0 to generate the appropriate HTML for a Silverlight control. The render method looks some thing like:-
protected override void Render(HtmlTextWriter writer) { if (DesignMode) { //Display something sensible here } else { writer.AddAttribute("data", "data:application/x-silverlight-2,"); writer.AddAttribute("type", "application/x-silverlight-2"); AddExistingAttributes(writer); writer.RenderBeginTag("object"); writer.AddAttribute("name", "source"); writer.AddAttribute("value", Page.ResolveUrl(Src), false); writer.RenderBeginTag("param"); writer.RenderEndTag(); writer.AddAttribute("name", "minRuntimeVersion"); writer.AddAttribute("value", "2.0.31005.0"); writer.RenderBeginTag("param"); writer.RenderEndTag(); writer.AddAttribute("name", "initParams"); writer.AddAttribute("value", InitParams); writer.RenderBeginTag("param"); writer.RenderEndTag(); writer.Write(@"<a href=""http://go.microsoft.com/fwlink/?LinkID=124807"" style=""text-decoration: none;""> <img src=""http://go.microsoft.com/fwlink/?LinkId=108181"" style=""border-style: none""/> </a>"); writer.RenderEndTag(); }
If you are developing for a public site you would need to include the silverlight.js and wire it up as per the normal HTML usage of the control so that it will automatically attempt to install silverlight and refresh the page when installed.
0 comments:
Post a Comment