Scott Booth's Blog
My Links
Blog Stats
  • Posts - 5
  • Stories - 0
  • Comments - 10
  • Trackbacks - 0
Archives

To help myself remember the process to create a report in ASP 2.0, I've decided to blog it here...

Note:  This is only the basic steps to create a simple local report using data objects. 

1. Create Stored Procedure to capture the data for the report

2. If an object does not already exist to store this data, create the class for the properties, the data layer (DAO), and business container(BC). 

3. Right click in your project, select New Item, then Report.  This will create a new RDLC file that you will use to create the report layout.

4. Create your datasource for the RDLC.  In the RDLC file, click Report-> Data Sources.  If you don't see “Report“ in the menu bar, click the RDLC file.  The menu bar should refresh.  Select the BC that returns the list of your data.  Click Add to Report.

Note:  This seems to be kind of buggy.  There have been times when no available data sources displays.  If this happens, try recompiling your solution.  If no data sources still displays, close the solution and reopen it.  If still nothing, try rebooting your computer.  Not sure why this happens, but eventually you will see the list of data sources.

Another thing to note, all data sources show in this list.  So all your BC, DAO, and Entity classes will show in this list.  Be sure to pick the BC.  There doesn't seem to be any rhyme or reason to how this list is sorted.  You just have to scroll through and pay attention.

5.  If you want to display a list of data, you will need a “list“ in the body.  Drag the list from the toolbox onto the report.  Set the “DataSetName“ property to the data source you created.  ASP.net has other controls besides a “list“ to display data.  Check the MSDN for documentation on these other controls.

6. Select the Web Data Sources on the left hand toolbar.  It shows all available data sources.  See above if nothing shows in the list.  Expand the correct data source that has your data list.  Drag the items you want onto the list.  The default items are only the First item in that list:  “=First(Fields!Name.Value)“.  Change this to “=Fields!Name.Value“ to show all items in this field.  You can right click on the item, select properties to change how it looks and add a function to the item.

7. Continue adding fields, and other controls to the report as needed.

Note:  One limitation with 2.0 Reporting Services is that you can not add a field to the page header or footer.  Or if you can, no one in Google has figured it out and is telling.  So your report titles must be generic. 

8.  When the report layout is done, create a new ASP page.  Drag the report viewer control onto the page.

9. Create a new object data source that points to the BC for your data.

10.  Run the project and see how you did.

Note:  If there is an error in the RDLC, you may see many errors like fields can not overlap a line and other formatting errors.  Typically there is only one error, like an invalid data source, that once you correct, all the other errors will go away.

posted on Monday, January 23, 2006 10:59 AM
Feedback
No comments posted yet.
Title  
Name  
Url
Comments   
Protected by Clearscreen.SharpHIPIn order to prevent spam, please enter the code to post a comment.:
Scott Booth