Thursday, October 22, 2009

Working with Microsoft Report Viewer Control in asp.net web application

If you would like to display data in matrix form then Microsoft report viewer control is perfect one for you.
I just show below how you use this control in your application

Create new project – name it as ReportViewer
Add new dataset to your application
Solution-> add new item - > data- Dataset
Go to toolbox as shown below



Drag Table Adapter on Dataset designer

Configure the Data source as shown below. Specify your database


Click next –> then specify your connection string


Click next -> if you have database query specify SQL statements or stored procedure as per your requirements


Click next-> next -> click finish


Now Dataset is configured with data source. Your dataset is ready

Now add rdlc file as shown below to your application.

Solution- Add new Item-> Reporting->Report


Now drag matrix from toolbox on rdlc designer


Now open website data sources (from menu – Data-Show data sources)


Drag fields on matrix as you require displaying data in the matrix


And now save the changes

Now add new web page to your application

Add Microsoft report viewer control on this page

(Drag from Toolbox -> Reporting -> Microsoft Report Viewer)
Select the created rdlc file as your report  as shown below



And save your application and run application

Now your data is displaying in matrix format!!!. Change font, background color as you require.  enjoy the  beauty of this control :) It saves lots of your time for sure....


If you find any issues please write me comment.
Happy coding….

4 comments:

  1. Hi..
    i dont see 'Microsoft Report Viewer' in my toolbox... :(
    i dont even have in component list...
    its in 2008 ?

    ReplyDelete
  2. Hi shiva,
    ya its in visual studio 2008
    even u have it in vs 2005 under tab Data->ReportViewer

    ReplyDelete
  3. Hi shiva,
    ya its in visual studio 2008
    even u have it in vs 2005 under tab Data->ReportViewer

    ReplyDelete
  4. hi, i did all that is explained above and i'm getting this error when i run the webpage with the report viewer.

    THE REPORT VIEWER WEB CONTROL REQUIRES A SYSTEM.WEB.UI.SCRIPT MANAGER ON THE WEB FORM

    ReplyDelete