Blogger :
MSDN Blogs
All posts :
All posts by MSDN Blogs
Category :
SAP CRM
Blogged date : 2008 Jan 25
I’ve to my SilverLight app up and running at www.crmlivets.com
This app is a viewier for screen cast demo’s of CRM Live. It uses a tree control that I developed.
I thought I would spend a bit to explain some SilverLight development stuff that I don’t think is obvious to most. There are lots of blogs with code examples and such so don’t expect much in that from this blog. I’ll try to keep it relative to content that I didn’t find easily in other places.
The simple model is a pure html application that host the Silverlight control and uses jscript to code against the control. The next model up the food chain is to have an ASP net application that includes a silver light control. Again, not to hard. The tricky stuff is interaction between your code and control. First off, the control is run on the client machine so you can’t just code to it from ASP. You can build .Net components that manage the control but still, you’re not directly talking to those objects from ASP. A simple way to interact between the code that manages he control and the logic in your ASP application is with hidden fields. The fields are available to both the managed code and jscript that you use to handle events, etc in SilverLight. The thing to remember is that the code, whether it’s jscript or .Net runs on the client side with the control. You can also use both and have both managed code and jscript code call methods in one another. Handy… there’s a ton more you can do in managed code than jscript but jscript is useful.
How to add SilverLight to my existing ASP.net apps ?
An easy model to implement is to first create a VS2008 SilverLight Control. For example, a simple bar chart. Add the control to the html of your asp.net application. Include a reference to the library. You’ll also need to reference the SilverLight.dll library. In your xaml, you’ll have a object of your control. When the page loads, the silverlight control is loaded which process’s the xaml, which has a object of your control type and creates an instance of your control. Great, I now have a ASP.net application that has a silverlight control in it. To interact with it, create hidden fields on your form and initialize them during the Page_Load event. Next, during the Canvas load event you can retrieve the values and use them accordingly in your control. It’s a simple way to have a control that gets load with dynamic data.