Showing posts with label ReportViewer. Show all posts
Showing posts with label ReportViewer. Show all posts

Friday, November 22, 2013

Microsoft Reporting WebForms Version Conflict Error resolved..


Error message:
This example is taken with reference to report viewer version 10.0.0.0 and version 9.0.0.0

The type 'Microsoft.Reporting.WebForms.IReportServerCredentials' exists in both 'C:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\9.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dll' and 'C:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\10.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dll'   

Solution:

Step 1. Open the Solution Explorer and right click on the Solution and select Property Pages.
Step 2. click on references and choose the report viewer which is no required.
Step 3. Click on remove and then build the solution.
















 Error resolved...!!!

For any further information on crystal report you can visit
1. Microsoft MSDN
2. Wikipedia

Sunday, October 14, 2012

Display Report Using Report Viewer on Button Click using C# in asp.net

To Display the Report on Microsoft Report Viewer following are the steps:

Step 1 : Add the Microsoft Report Viewer from Reporting tab of the Tool Box.

Fig : To Add Report Viewer in the Design Page.

 Step 2: On "Show" Button Click display the report.

On button click we provide the Report Viewer parameters to display the appropriate report with respect to the data provided using the dropdownlist.

Fig 2: Report Display
In the above figure Fig 2, the user selects the details from the dropdownlist and is passed as parameter on "Show" button click.

Step 3: Code to be written on Show Button Click event.

 protected void btnShow_Click(object sender, EventArgs e)
    {
        try
        {
            ReportParameter[] parm = new ReportParameter[2];
            parm[0] = new ReportParameter("<BatchYear>", ddlBatch.SelectedValue);
            parm[1] = new ReportParameter("<ProgramCode>", ddlProgramName.SelectedValue);
            ReportViewer1.ShowCredentialPrompts = false;
            ReportViewer1.ShowParameterPrompts = false;
            ReportViewer1.ServerReport.ReportServerCredentials = new ReportCredentials(UserId, Password, DomainName);
            ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
            ReportViewer1.ServerReport.ReportServerUrl = new System.Uri(ReportServerUrl);
            ReportViewer1.ServerReport.ReportPath = "//<ReportPath>"; 
            ReportViewer1.ServerReport.SetParameters(parm);
            ReportViewer1.ServerReport.Refresh();
        }
        catch (Exception ex)
        {
            DisplayAJAXMessage(this,"Error:: "+ex);
        }
    }


static public void DisplayAJAXMessage(Control page, string msg)
    {
        string myScript = String.Format("alert('{0}');", msg);
        ScriptManager.RegisterStartupScript(page, page.GetType(), "MyScript", myScript, true);
    }


Note: The text shown in bold need to added as per requirement

View Amit Lal's profile on LinkedIn
Showing posts with label ReportViewer. Show all posts
Showing posts with label ReportViewer. Show all posts

Friday, November 22, 2013

Microsoft Reporting WebForms Version Conflict Error resolved..


Error message:
This example is taken with reference to report viewer version 10.0.0.0 and version 9.0.0.0

The type 'Microsoft.Reporting.WebForms.IReportServerCredentials' exists in both 'C:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\9.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dll' and 'C:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\10.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dll'   

Solution:

Step 1. Open the Solution Explorer and right click on the Solution and select Property Pages.
Step 2. click on references and choose the report viewer which is no required.
Step 3. Click on remove and then build the solution.
















 Error resolved...!!!

For any further information on crystal report you can visit
1. Microsoft MSDN
2. Wikipedia

Sunday, October 14, 2012

Display Report Using Report Viewer on Button Click using C# in asp.net

To Display the Report on Microsoft Report Viewer following are the steps:

Step 1 : Add the Microsoft Report Viewer from Reporting tab of the Tool Box.

Fig : To Add Report Viewer in the Design Page.

 Step 2: On "Show" Button Click display the report.

On button click we provide the Report Viewer parameters to display the appropriate report with respect to the data provided using the dropdownlist.

Fig 2: Report Display
In the above figure Fig 2, the user selects the details from the dropdownlist and is passed as parameter on "Show" button click.

Step 3: Code to be written on Show Button Click event.

 protected void btnShow_Click(object sender, EventArgs e)
    {
        try
        {
            ReportParameter[] parm = new ReportParameter[2];
            parm[0] = new ReportParameter("<BatchYear>", ddlBatch.SelectedValue);
            parm[1] = new ReportParameter("<ProgramCode>", ddlProgramName.SelectedValue);
            ReportViewer1.ShowCredentialPrompts = false;
            ReportViewer1.ShowParameterPrompts = false;
            ReportViewer1.ServerReport.ReportServerCredentials = new ReportCredentials(UserId, Password, DomainName);
            ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
            ReportViewer1.ServerReport.ReportServerUrl = new System.Uri(ReportServerUrl);
            ReportViewer1.ServerReport.ReportPath = "//<ReportPath>"; 
            ReportViewer1.ServerReport.SetParameters(parm);
            ReportViewer1.ServerReport.Refresh();
        }
        catch (Exception ex)
        {
            DisplayAJAXMessage(this,"Error:: "+ex);
        }
    }


static public void DisplayAJAXMessage(Control page, string msg)
    {
        string myScript = String.Format("alert('{0}');", msg);
        ScriptManager.RegisterStartupScript(page, page.GetType(), "MyScript", myScript, true);
    }


Note: The text shown in bold need to added as per requirement

View Amit Lal's profile on LinkedIn