DataGrid Datasource

5 posts, 0 answers
  1. Richard
    Richard avatar
    18 posts
    Member since:
    Dec 2008

    Posted 08 Dec 2008 Link to this post

    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

  2. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 09 Dec 2008 Link to this post

    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.
  3. DevCraft banner
  4. Ben Hayat
    Ben Hayat avatar
    892 posts
    Member since:
    May 2008

    Posted 09 Dec 2008 Link to this post

    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!
  5. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 09 Dec 2008 Link to this post

    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.
  6. Richard
    Richard avatar
    18 posts
    Member since:
    Dec 2008

    Posted 09 Dec 2008 Link to this post

    Hi,

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

    Thanks for the help

    Rich
Back to Top
DevCraft banner