SSRS

whoah it's been 1 days to solve this issue,

everything below is using local report with SSRS not report server.

when using localreport with Microsoft report viewer, been quite a mystery, when somethings got wrong , it just display simple error which also a mystery. i search the net but found not a brief explanation

any way , when you are using sub report, the trouble gots higher.

you've got to manually bind the value for each object data source.

First step is to add event handler

Page load

{

     ReportViewer1.LocalReport.SubreportProcessing += new Microsoft.Reporting.WebForms.SubreportProcessingEventHandler(LocalReport_SubreportProcessing);
   
     ReportViewer1.ReportRefresh += new System.ComponentModel.CancelEventHandler(ReportViewer1_ReportRefresh);
    }

    void ReportViewer1_ReportRefresh(object sender, System.ComponentModel.CancelEventArgs e)
    {
        ObjectDataSource1.DataBind();
        ObjectDataSource2.DataBind();
        ObjectDataSource3.DataBind();
    }
////this is processed row by row

//you've got to attach the report parameter to object datasource

//on local mode you need to do this

   void LocalReport_SubreportProcessing(object sender, Microsoft.Reporting.WebForms.SubreportProcessingEventArgs e)
    {

        e.DataSources.Add(new ReportDataSource("SubWipproposal_WipProposal", "ObjectDataSource2"));
        ObjectDataSource2.SelectParameters[0].DefaultValue = e.Parameters[0].Values[0];
        e.DataSources.Add(new ReportDataSource("PipeLineDataset_GetProducttype", "ObjectDataSource3"));
        ObjectDataSource3.SelectParameters[0].DefaultValue = e.Parameters[1].Values[0];
        ObjectDataSource3.SelectParameters[1].DefaultValue = e.Parameters[0].Values[0];

    }

Error: SubReport could not be shown

Solution:

1.Check every data source: the main report and the sub report , by clicking vside menu , report ->Datasource , already included the source of your report, add as necessary

2.Check  the naming of the dataset,report ->Datasource,must match  from the add report datasourcename (case sensitive) on subreportprocessing event

3.CHeck that your sub report parameters already define the same as the parameters being pass from main report

Error: "Text box.A Scope..."    

Solution: for multiple dataset in one report you  need to define the scope of each textbox. for ex:(=First(Fields!producttype.Value, "PipeLineDataset_GetProducttype") the bold one is the scope

 

when using multiple datasource, it's better to use .List and then in that list there's a sub report

Hope this help

Mark as answer :) :)

Share this post: | | | |
Published Wednesday, July 16, 2008 10:56 AM by cipto
Filed under:

Comments

No Comments

Leave a Comment

(required) 
(required) 
(optional)
(required) 

Enter the numbers above: