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

Reporting Parameter Datasource Dynamic Binding

1 Answer 574 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sekar
Top achievements
Rank 1
Sekar asked on 15 Apr 2009, 05:02 PM
Hi There
   I'm having a datatable prepared from the business layer and i need to use that for report parameters. But i am having hard time binding a column in that parameter.

Consider that i want to bind the (ProductId, ProductName) first & second column of the datatable to this report parameter and i want it to show all the row data as a multi value
public RegistrationSummaryReport() 
{
InitializeComponent();
            DataView source = getDataSource();  
            this.DataSource = source;            
            ReportParameter param = new ReportParameter(); 
            param.Name = "paramEP"
            param.Type = Telerik.Reporting.ReportParameterType.String; 
            param.UI.AvailableValues.DataSource = source
            param.UI.AvailableValues.ValueMember = "=Fields.ProductId"
            param.UI.AvailableValues.DisplayMember = "=Fields.ProductName"
            param.UI.MultiValue = true
            param.UI.Visible = true
            this.ReportParameters.Add(param); 

But as soon as i add this binding, and while executing the report gets empty and not even shows the rest of the report and when i remove the parameter addition and just binds the report and render all the data

I tried a work around to show the dropdown parameter in report viewer by doing the below code snippet instead.
public RegistrationSummaryReport() 
        {
InitializeComponent();
            DataView source = getDataSource();  
            this.DataSource = source
 
            List<string> eps = new List<string>(); 
            foreach (DataRowView dr in source) 
               eps.Add(DataUtility.MakeNullEmpty(dr["ProductName"])); 
             
            ReportParameter param = new ReportParameter(); 
            param.Name = "paramEP"
            param.Type = Telerik.Reporting.ReportParameterType.String;           
            param.UI.MultiValue = true
            param.UI.Visible = true
            param.Value = eps
            this.ReportParameters.Add(param); 

And now it shows the report and also the report parameter dropdown but with all the product name separated by semicolon in the value as it is coded to set as value (not as datasource) but i can only edit them but instead i want it to be a set of checkbox in the pulldown box of dropdown so that user can easily select them (as it would appear when i assign the datasource in design time).

Software Details
  • Windows XP sp2
  • Telerik Reporting Q1 2009
  • Visual Studio 2008

Please guide me a way to assign datasource to parameters dynamically. Thanks in advance. I greatly appreciate a sooner response.

1 Answer, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 16 Apr 2009, 07:41 AM
Hi Sekar,

It is normal to have the values separated by semicolon, when you have multivalue parameter with several selected values as can be seen from our Product Line Sales demo report. You can find more information and a sample project on using multivalue parameter in this blog post.

Kind regards,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
General Discussions
Asked by
Sekar
Top achievements
Rank 1
Answers by
Steve
Telerik team
Share this question
or