Feed Icon  


  • Bryant Likes
  • Send mail to the author(s) E-mail
  • twitter
  • View Bryant Likes's profile on LinkedIn
  • del.icio.us
Get Microsoft Silverlight
by clicking "Install Microsoft Silverlight" you accept the
Silverlight license agreement

Hosting By

Hot Topics


Open Source Projects



Reporting Services WebParts - Part II

Posted in Reporting Services | SharePoint at Wednesday, May 12, 2004 4:12 AM Pacific Daylight Time

This articles builds on Part I of the series where we developed a simple Reporting Services (RS) WebPart that displayed information about a RS Report. In this article we will look at building two more WebParts: the RS Server Explorer and the RS Report Viewer. We will also explore how to connect these parts together.

Before we create the first webparts, we should really create a new base class that we can use to put all the common functionality in. This will allow us to not repeat the same sections of code over and over. Below is the C# code for the RsBasePart.cs that you should add to your project. For now it just uses the ToolPart code to show the ToolPart on the top and it loads the common rs.js script file.

namespace Bml.RsWebParts
 public abstract class RsBasePart : WebPart
  public override ToolPart[] GetToolParts()
   ToolPart[] toolparts = new ToolPart[2];
   WebPartToolPart wptp = new WebPartToolPart();
   CustomPropertyToolPart custom = new CustomPropertyToolPart();
   toolparts[1] = wptp;
   toolparts[0] = custom;
   return toolparts;
  protected override void OnLoad(EventArgs e)
   Page.RegisterClientScriptBlock("rs", Globals.GetResourceScriptTags("rs.js"));
   base.OnLoad (e);

You can now change the RsReportInfo WebPart to inherit from this base class by changing the class declaration line to read:

public class RsReportInfo : RsBasePart

The first WebPart we will create is what I call the RS Server Explorer WebPart. This WebPart can be used to browse the RS Server and select a Report to display in the RS Report Viewer WebPart (which we will create next). Just like the first WebPart we created, this WebPart will use a mixture of client side and server side programming. To get started, open your project and select Add New WebPart and name it RsExplorer.cs. Next delete all the code in the body of the RsExplorer class. The first thing we need to do is a property that we will use to configure this WebPart. This is shown below along with the class declaration:

namespace Bml.RsWebParts
  ToolboxData("<{0}:RsExplorer runat=server>"),
 public class RsExplorer : RsBasePart
  string _serverUrl = String.Empty;
   Category("Reporting Services"), 
   FriendlyName("Server URL"), 
   Description("Server url such as http://localhost/reportserver")]
  public string ServerUrl
   get {return _serverUrl;}
   set {_serverUrl = value;}

So now we can set the server url of the server that we want to explore.

Comments are closed.