Sunday, 1 November 2015

Use Report Viewer Control to View SSRS Report in Windows Application

Advertisement





1. First of all open Visual Studio 2010 and go to File-> New-> Project.
1-Use Report Viewer Control to View SSRS Report in Windows Application
2. A New Project window opens. In that window select Visual C# from left pane and select Windows Forms Application as shown in below screenshot.
2-Use Report Viewer Control to View SSRS Report in Windows Application
Then click on OK button.
3. Visual Studio 2010 will add a single form to the project calledForm1.cs. Rename that form to ViewerForm.cs.
4. Resize that form to 1024 x 768 dimension.
4-Use Report Viewer Control to View SSRS Report in Windows Application
5. Now add a ReportViewer control named as rptViewer from Reportingcontrols.
6. Then add a textbox, and name it txtReportURL. Also add a button namedbtnShowReport and set the button Text property to Show Report. Now your form design looks like below:
6-Use Report Viewer Control to View SSRS Report in Windows Application
7. Now write below code into the click event of Show Report button.
1
2
3
4
5
6
7
private void btnShowReport_Click(object sender, EventArgs e)
{
    rptViewer.ProcessingMode = ProcessingMode.Remote;
    rptViewer.ServerReport.ReportServerUrl = new Uri(@"http://bhushan-pc/ReportServer2012");
    rptViewer.ServerReport.ReportPath = txtReportURL.Text;
    rptViewer.RefreshReport();
}
7-Use Report Viewer Control to View SSRS Report in Windows Application
8. Now press F5 button. In textbox enter the Path to access the report which is something like below :
/StartSSRS/PersonWithPhoneNumber
9. Then click on Show Report button. You will see result looks like below :
9-Use Report Viewer Control to View SSRS Report in Windows Application


EmoticonEmoticon

:)
:(
hihi
:-)
:D
=D
:-d
;(
;-(
@-)
:o
:>)
(o)
:p
:-?
(p)
:-s
8-)
:-t
:-b
b-(
(y)
x-)
(h)