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

Generic List as Parameter

1 Answer 405 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
George
Top achievements
Rank 1
George asked on 13 Jul 2011, 07:04 PM
I am using the report controls in our mvvm silverlight application. I am passing in 5 different parameters within a dictionary. the last item in this dictionary is a List<int>. This list contains ids that I will then use against an entity to create my report from. 

I am finding no luck anywhere on how to pass in a generic list as a parameter. Again we are using an MVVM pattern so the examples I have seen online that use codebehind are not much help. I am sure that I am missing something within the report itself that will allow me to use a Generic list.

1 Answer, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 15 Jul 2011, 08:31 AM
Hi George,

Currently the approach from the Programmatic Initialization of Report Parameter Values in Telerik Reporting Silverlight Viewer KB article is the only way to pass parameters from the Silverlight client to the reports on the server. So, yes there is no pure MVVM solution as there is no report definition on the client.
Generally Report Parameters allow you to specify or control the data used in a report, connect related reports together and vary report presentation. Using them to pass a datasource for the report is not a correct approach.
As you can see from the referenced article, the available types are Boolean, DateTime, Integer, Float and String. So you can use a string parameter (concatenate the list values) and separate them in the report NeedDataSource event prior usage i.e.:
Copy Code
private void Report1_NeedDataSource(object sender, System.EventArgs e) 
   
           var parameters = this.ReportParameters;
              //..... use against entity to create data source
           this.DataSource = yourdatasource; 
   }

Regards,
Steve
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
General Discussions
Asked by
George
Top achievements
Rank 1
Answers by
Steve
Telerik team
Share this question
or