Confused on Adding parameter for Object Datasource to connect to a webservice

2 posts, 0 answers
  1. danparker276
    danparker276 avatar
    389 posts
    Member since:
    Aug 2010

    Posted 29 Aug 2012 Link to this post

    I've looked around on the docs and threads, but I can't seem to figure out the best way to get data from a WCF webservice with parameters.  Of note, I'm using silverlight and can't bind my data to the report.

    I create a Objectdatasource and it maps my return object ok when I add a service reference.  But I don't see how to add parameters to my  WCF webservice?

    The examples I've seen only show web services with no parameters.

    Do I need to do a binding for the datasource and then call my webservice in that?
            public static ObjectDataSource ChangeConnectionString(object reportItem)
                var report = (reportItem as Telerik.Reporting.Processing.Report);
                var dataSource = (Telerik.Reporting.ObjectDataSource)report.DataSource;
    MyService.MyClient client = ...
    //How do I bind it to my datasource?
    return datasource;???

    Or do I add parameters like this:
    objectDataSource.Parameters.Add(new Telerik.Reporting.ObjectDataSourceParameter("productModelID", typeof(int), 23));

    Are the parameters in quotes supposed to match the parmeters of the webservice?
  2. Elian
    Elian avatar
    435 posts

    Posted 03 Sep 2012 Link to this post

    Hi Dan,

    Since you are using Silverlight, the report's data-source cannot be set from outside and the only way is to consume the service from the report itself. Create an ObjectDataSource which will consume the service. The ObjectDataSource will have the same parameters as the data-retrieval method of the service. 
    This article shows how to pass parameters when using Silverlight report viewer. 
    You can find attached an example showing how to consume WCF service with parameters in Silverlight. 
    the Telerik team

    BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >

  3. DevCraft R3 2016 release webinar banner
Back to Top