CHAPTER 9 RENDERING REPORTS FROM .NET APPLICATIONS
Figure 9-11. Adding a Web service reference
Now that you have the Web service ready to reference, you can populate the drop-down list with
report items from the Chapter_9 directory of your SSRS instance. You should already have at least one
report in that folder from the setup of this chapter.
You will use the Web service you have just registered to retrieve all of the report items from the
Chapter_9 directory. The Web service method you will use to do this is ListChildren. This function takes
two parameters: the path from where to gather the list from and a Boolean value to determine whether
the search should be recursive. Since you want to get the reports from the Chapter_9 folder and nothing
else, you want to pass only that path and a false value to get only the reports in this one directory.
You want to populate the drop-down list with only report items. However, ListChildren will return
all the items in this folder, not just the reports. You will use the TypeName property to determine the
type of the returned object and only list reports. Once you have tested whether the item is a report or
not, you will populate the drop-down list with the names of the reports. The code to perform all of this
exists in the Page_load method of the page, so that you start with a full drop-down list as soon as the
page is done loading. Listing 9-15 shows the code used to populate the drop-down list from the Web
service.
Listing 9-15. Using the SSRS Web Service to Populate the Report List
SSRS_WebService.ReportingService2010 rs = null;
protected void Page_Load(object sender, EventArgs e)