1

I have seen examples where you can pass parameters between aspx and silverlight app as well as how to pass simple values back to aspx.

Is it possible to pass generic types such as list collections from a silverlight app to a asp.net page to be picked up. I have looked at serialization but not sure if this is the best approach due to performance?

Thanks in advance

rlcrews
  • 3,482
  • 19
  • 66
  • 116
  • FYI i have seen the answer posted at http://stackoverflow.com/questions/354453/pass-objects-to-silverlight-through-server-side-asp-net-code Which covers JSON / serialization... Just interested to see if anyone found another approach – rlcrews Jul 13 '10 at 23:16

3 Answers3

2

You can also communicate with your .aspx page client-side, through scriptable objects... see HtmlPage.RegisterScriptableObject(string, object) in Silverlight documentation.

PjL
  • 982
  • 7
  • 10
0

Since Silverlight is client-side and ASP.Net is server-side, you will need to use serialization in order to pass objects between the two.

I would consider using the DataContractSerializer in Silverlight to serialize the object as XML. You can then push the XML up any way you want: ASPX web service, WCF service, HTTP PUT, Hidden fields in the HTML, etc.

Brian Genisio
  • 47,787
  • 16
  • 124
  • 167
0

Review: Sharing C# code between Windows and Silverlight class libraries

Your Answer will be listed within that solution already provided for the same question or nearly exact.

Excerpt:

You cannot set a reference from a Silverlight assembly to a regular .NET assembly but you can do so the other way round.

So create a shared Silverlight assembly and add your code to that assembly. Now you can set a reference fro both your regular .NET and you other Silverlight assembly to the shared Silverlight assembly.

The restriction is that you can only put code in there that would work on both the .NET and Silverlight CLR but that is no different from sharing code.

Courtesy: Maurice

Community
  • 1
  • 1
  • Thanks Joe. In looking at the example they are sharing code (methods) I only want to share a collection of objects,such as a list collection which contains name age height weight, for multiple people? My sl app provides the user the ability to view multiple people and through the app the can select certain people. One selected these names should be passed back to a asp.net app for consumption and use. I see how it is possible to share methods/ code but I'm still not sure how this would apply towards a type/collection of data. Can you point me to any other examples? Thank you. – rlcrews Jul 14 '10 at 03:27
  • Sorry, randyc I have been quite busy...at present there is limited examples of crossing silverlight assembly to .net. I am speculating that though, it is possible there are very few developers outside of MSFT folks that have actually performed any of this crossover development. I will keep any eye open but, this is the closest solution that I have found...to your particular request. –  Jul 19 '10 at 15:39