I have a Silverlight application that gets a list of contacts and displays them in a datagrid. The application needs to also support exporting the contacts to Excel and printing the contacts as an HTML page.
I'm using WCF RIA services to construct most of the query on the Silverlight client and then the server adds some additional where clauses to the query as well.
I'm trying to figure out if there is a way to run the results of the query using an ASP.Net page which will format them and prompt the user to download the results (or print the results).
The only idea I've come up with is to save the IQueryable object as a variable on the server side and return the key back to the Silverlight page. Then pass the key to either Export.aspx or Print.aspx which would grab the results of the query and return them.
Any better ideas?
It seems like there must be a better way that I'm just not thinking of.
So I was finally able to do this after a lot of work and research. To make it work I had to use some of the WCF RIA Services internal classes (via decompile) on the Silverlight side to generate the proper query string to pass to the ASP.Net page. Then on the server side I had to decompile even more classes to parse the query string and turn it into a valid Linq query. Now it all works and I can run the query in the code behind and output the results as a file.
If anyone is interested let me know and I can try to share the gory details. Thanks!