Getting data out of a Silverlight control

末鹿安然 提交于 2019-12-11 12:32:28

问题


I am relatively new to Silverlight development and I am trying to figure out how to get data out of a silverlight control that I have made.

I have a Silverlight control that gathers a bunch of graphical data points. The Silverlight control is embedding in a asp.net webforms application. The page that is displaying the control also does other data specific functions and when the user clicks a button I need to perform some manipulation of the data (both webform data and the data contained in the Silverlight control) and then save the data with 1 call to the DB.

My question is how do I get the data out of the Silverlight control from my webform to be able to put the data together for the save?

My initial thought was to make the data in the Silverlight control accessible via Javascript and then on the button click, save the Silverlight control's data to some html control and then allow the regular webform post to occur and read the data server side. Is there a better way to do this as it feels a little messy.

Note: I am using .NET 3.5 and Silverlight 3.0.


回答1:


You have a lot of options:

  • You can have your Silverlight control submit the data directly to the server, using ADO.NET Data Services or a webservice call which processes the data

  • You can use RIA Services, which simplifies the process of interacting with server-side code from Silverlight

  • You can have the Silverlight control update a form field (hidden, probably) which then can be processed and submitted via the web page




回答2:


Marc Gravell's protobuf-net library for silverlight may be an option for server side comms. Googles protocol buffers can comunucate with lots of lauguages.



来源:https://stackoverflow.com/questions/1289548/getting-data-out-of-a-silverlight-control

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!