Search code examples
silverlightquery-stringwcf-ria-services

How do you access the fields in a WCF RIA generated Silverlight app


How do you access the controls in a WCF RIA generated Silverlight app?

I've got the page being opened with a number of query string variables What I'm trying to do is set the values of the controls on the Silverlight control to these values

EDIT: there seem to be three approaches, InitParams, QueryString and HtmlPage.Document

Full details on Brij Mohan blog post


Solution

  • You have to remember that XAP file is the SECOND item that is downloaded from the website, it is not the first page. Look into the Javascript of the first page, you will see there are a number of parameters that are issued on the command line to execute the Silverlight application. It is here that you take the QueryString on the first page, and pass it on to the Silverlight application. Couple of links for you....

    CodeProject Example - Shows the mechanics, but not a great implementation

    MSDN Documentation