Reputation: 6249
I have an ASP.Net website, that uses a MySQL database.
First of all, because the Connect/Net of MySQL doesn't install on PC (reason unknown, no error, it just doesn't work) I'm using ODBC for the connection.
I've written some nice wrapper classes for using the database, and it's all working ok.
But now I'm adding a little Silverlight application to my website (first thing I'm making with WCF/Silverlight, without actually reading any tutorial, so let's hope for the best).
Now this application won't be anything fancy, it's only for the administrators, to read the logs, and change some configuration settings, etc, nothing fancy at all. But what it has to do is retrieve data from the services.
What I've done is a setup a service reference, and it works like a blessing, but now I'm trying to read the logs from the service, and I'm getting in trouble, because my class was never built to serialize to XML, first issue. And secondly I wouldn't know how to bind the retrieved data at the client to the datagrid.
I'm going to parse the recordset at the server so that I'll be sending a class containing an array of columns, and a multi-dimensional with the data to the client, now that's not much of a problem, I'm just mentioning it so that you can either improve or keep in mind what the data will look like.
My question: How would I bind that retrieved data to a plain <sdk:DataGrid>?
Upvotes: 1
Views: 845
Reputation: 8231
You can create your own in-memory DataSet/DataTable without it being hooked up to any particular database. You can populate it yourself using anything you want in the Silverlight application. Bind your DataGrid to it after you've filled it, as you normally would do on a simple client/server ASP.NET application.
Take the retrieved data from the web service, and populate a dataset. Then bind the dataset to the datagrid. You need to write some code-behind code for this, but not much. You can't do it all in the presentation layer's XAML.
(Edit: clarification for client/server/silverlight model)
Upvotes: 2