CHAPTER 9 RENDERING REPORTS FROM .NET APPLICATIONS
Figure 9-1. The ViewerWBC.cs form
Coding the Viewer Form
To code the viewer form, you’ll add the code necessary to use this custom report viewer to render the
SSRS 2012 reports. You need to add some code to the button’s click event to make sure you can browse
to and view an existing report. Make sure the ViewerWBC.cs form is open in design view, and double-
click the Run button. This will create an empty method to handle the button’s click event. Add the code
in Listing 9-1 inside the reportRun_Click method to your method.
Listing 9-1. reportRun click Event: Browsing to URL
private void reportRun_Click(object sender, EventArgs e)
{
webBrowser.Navigate(reportURL.Text);
}
Now run the project in debug mode. When the form displays, enter the following URL into the
textbox:
http://localhost/reportserver/?/Pro_SSRS/Chapter_9/EmployeeServiceCost&rs:Command=Render