Essentially I added a new Silverlight project into an existing web application (C#) that I’ve been working on. I did this in order to make use of the nice Telerik Controls for silverlight. More precisely, the ChartView Control (link).
I’d like to use this to chart out revenue generated by say, a customer, over the last month.
So for example, let’s say i have an .aspx page that brings up a customer based on his GUID (I fecth his data via an api call to the back-end application). In the result I’ll have all of that customers relevant infortation plus a list of amounts for money for the last 30 days (so thirty values) as an array.
If I create a Silverlight chart and embed it into that customer page, How can I pass in that array of money amounts so that I can plot a chart with my silverlight control??? Or any other data?
Using WCF is one good approach, especially if you’ve already got WCF up and running for other purposes. But there are other ways to do it as well, particularly if the data already exists on the web page by the time the Silverlight application is loaded. Two of them include:
(1) If the data is static, and not likely to change over the lifetime of the page, you can pass data into the Silverlight application using the “initParams” parameter (see here).
(2) A more flexible approach, but one which could take a bit more work, is to expose some of your Silverlight application’s methods to JavaScript, and pass data and other parameters in that way (see here).