Click here to Skip to main content
15,890,282 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Need a neat example for a drilldown report using RDLC in asp.net 4.0 without using application block.
Posted
Comments
Sandeep Mewara 6-Aug-12 15:01pm    
What did you try from your side?
R.SIVAA 7-Aug-12 2:16am    
getting error "A data source instance has not been supplied for the data source 'ModelSet'"

Step 1: Create a typed Dataset and add DataAdapters for Main and Sub rdlcs by pulling table or thru Stored procedure.
Step 2: Design two RDLCs Main.rdlc and Sub.rdlc
Step 3: Create Paramater in Sub.rdlc
Step 4: in Main.rdlc, right click on the column-'Text Box Properties'. Go to Action - Choose 'Go to Report'. Choose Sub.rdlc under 'Specify a report' then add the Parameter, give the one you created in Sub.rdlc and select the database column value to pass.
Step 5. Create a webform, drag the report viewer and go to its Drilldown event in code behind and write the code as below

protected void ReportViewer1_Drillthrough(object sender, DrillthroughEventArgs e)
        {
            
            LocalReport report = (LocalReport)e.Report;
                int MakeId = 0;
                IList<ReportParameter> list = report.OriginalParametersToDrillthrough;
                foreach (ReportParameter param in list)
                {
                    //Since i know the parameter is only one and its not a multivalue 
                    //I can directly fetch the first value from the Values array.
                    MakeId = Convert.ToInt32(param.Values[0]);
                }
                DataSets ds = new DataSets();
                ds.EnforceConstraints = false;
                SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["Cons"].ConnectionString);
                con.Open();

                SqlCommand cmd = new SqlCommand("ModelSivaa");
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Connection = con;
                cmd.Parameters.AddWithValue("@MakeId", MakeId);
                cmd.ExecuteNonQuery();
                SqlDataAdapter adap = new SqlDataAdapter(cmd);
                adap.Fill(ds, "Modeltable");
                report.DataSources.Add(new ReportDataSource("ModelSet", ds.Tables["Modeltable"]));
 
Share this answer
 
 
Share this answer
 
v2
Comments
R.SIVAA 7-Aug-12 2:26am    
Vani: complete step by step solution would be good as Im new to RDLC
Vani Kulkarni 7-Aug-12 2:53am    
Updated the answer. Try searching google sometimes, there is no harm in it.
R.SIVAA 7-Aug-12 3:10am    
Vani: Thanks, the link you have provided is the simple RDLC not a DrillDown. However I have explored and found and working on multiple drill-downs, soon i ll post the answer which would be usefull for many.
Vani Kulkarni 7-Aug-12 3:23am    
I know Sivaa. I gave the link as a heads up for you. So that you could keep this as a base and build your drill down report.
R.SIVAA 7-Aug-12 5:52am    
Thanks Vani

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900