This is a migrated thread and some comments may be shown as answers.

DataGrid Datasource

4 Answers 186 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 08 Dec 2008, 05:21 PM
Hi,

I am currently not developing in silverlight but want to create a version of  my existing app for silverlight.  Currently I have a web service that returns a dataset which is then displayed in a winform datagrid.    What does the ASP.NET host need to do with the dataset to make the dataset content and schema available the the silverlight client?   I don't think linq is an option for me since the heart of the web service is creating hiarchtical datasets dynamically and therefore the client must display the results dynamically.  This works well with Winform but how is this done in silverlight?  I hope this make sense.

Thanks
Rich

4 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 09 Dec 2008, 02:11 PM
Hello Richard,

ADO.NET classes like DataTable, DataRow, etc are not available in Silverlight and for that reason a direct access to a database is impossible. One of the best ways to access a database in Silverlight is to use a web service as an intermediary that can query a database on behalf of your Silverlight appliation.

Since you already have a web service, you just need to modifity it in such a way that it returns data that can be consumed by Silverlight. Instead of returning a dataset your service might return objects that represents you database data. For example, if your data rows contain customer data your web service might return a list of customer objects.

There are quite a few ways to do that so I'm sending you several blog posts that describe in details how to consume data using WCF:

Creating Web Services for Silverlight
Silverlight + WCF + LINQ to SQL
Consiming WCF Services in Silverlight
LINQ + WCF + Silverlight
Service-Driven Apps With Silverlight 2 And WCF

Another resource that might be useful is our JobBoard integration example. It is a Silverlight sample application that showcases some of our Silverlight controls and also makes use of web services that expose data to Silverlight. The source code of JobBoard is available here (you just need to be logged in at telerik.com).

Hope this helps.

Kind regards,
Milan
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Ben Hayat
Top achievements
Rank 2
answered on 09 Dec 2008, 02:30 PM
To add to what Millan had suggested, you also have ADO.Net Data Services that is a pre-built service as a data center service. Valeri did a nice sample of RADTreeView and ADO.Net Data Service (Astoria) that you may want to look at. Search in Blog for that. Great sample!
0
Milan
Telerik team
answered on 09 Dec 2008, 02:52 PM
Great suggestion Ben!

Here are the links to two acticles about ADO.NET Data Services that Valeri has posted:

Silverlight TreeView Load on Demand
RadControls for Silverlight Demo with ADO.NET Data Services

Best wishes,
Milan
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Richard
Top achievements
Rank 1
answered on 09 Dec 2008, 05:12 PM
Hi,

The "Creating and Consuming a WCF Service in Silverlight"  article was perfect. 

Thanks for the help

Rich
Tags
Menu
Asked by
Richard
Top achievements
Rank 1
Answers by
Milan
Telerik team
Ben Hayat
Top achievements
Rank 2
Richard
Top achievements
Rank 1
Share this question
or