ASP.NET
  Home arrow ASP.NET arrow Binding Data to the ReportViewer Control D...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP.NET

Binding Data to the ReportViewer Control Dynamically in ASP.NET 2.0
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 35
    2006-11-13

    Table of Contents:
  • Binding Data to the ReportViewer Control Dynamically in ASP.NET 2.0
  • Binding a SELECT statement to a ReportViewer control in ASP.NET 2.0: code
  • Binding an XML document to a ReportViewer control in ASP.NET 2.0
  • Binding a text file (with comma separated values or CSV) to a ReportViewer control in ASP.NET 2.0
  • Binding a customized ObjectDataSource (or business logic) to a ReportViewer control in ASP.NET 2.0
  • Binding a customized ObjectDataSource (or business logic) to a ReportViewer control in ASP.NET 2.0: code

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Binding Data to the ReportViewer Control Dynamically in ASP.NET 2.0


    (Page 1 of 6 )

    This is the second article in a series focusing on designing and presenting native reports using ASP.NET 2.0. Throughout this series, I will focus on working with the “ReportViewer” control in local mode to develop web-based applications.
    A downloadable zip file is available for this article.

    If you are new to working with the ReportViewer control, I strongly suggest you go through my first article in this series. That article really gives you a step-by-step approach to working with the ReportViewer control.

    The entire source code for this article is available in the form of a downloadable zip file. The solution was developed using Microsoft Visual Studio 2005 Professional Edition on Microsoft Windows Server 2003 Enterprise Edition together with Microsoft SQL Server 2005 Developer Edition.  I didn’t really test the solution with any other or previous editions. 

    Binding a SELECT statement to a ReportViewer control in ASP.NET 2.0: design

    I discussed several types of reporting strategies to implement in ASP.NET 2.0 applications in my first article. I also gave a step-by-step approach to working with the ReportViewer control in the same article.  So I will not be repeating any of that material here.

    In my previous article, I developed reports by directly connecting to database tables/views. That scenario won't be helpful every time. Let us imagine that I would like to develop a report based on a dynamic SELECT statement. This is a little bit tricky when compared to the approach I discussed in my previous article.

    First of all, we need to keep in mind that any “table” in a report (at local mode) must adhere to a structure. This structure will generally be a “strongly-typed-dataset.” Without creating a strongly-typed-dataset, it is very difficult to design a report. Creating a strongly-typed-dataset was covered in my previous article.

    Even now, to bind a report to a SELECT statement, we need to create a strongly-typed-dataset which contains exactly the same columns we retrieve using the SELECT statement. In other words, we will make filters, joins, sorting etc. dynamic, but not the structure (or set of columns). The structure (or set of columns) must always remain the same when designing or developing reports.

    For this scenario, I created a strongly-typed-dataset (called SalesData.xsd) as follows.

    It is simply a data table (dragged from the toolbox) with user specific columns.  It has no relation to any database, and no tableadapters are created.

    I added a new report (called SampleReport.rdlc) to the project and attached it to the dataset as follows:

    More ASP.NET Articles
    More By Jagadish Chaterjee


       · Hello guys! This is second in series focusing on reporting in ASP.NET 2.0. In this...
       · I am trying to generate a report using the report viewer control in VS2005 with the...
       · Great article, thanks for posting it!One small edit though. To get this to...
       · I am getting the following error when trying to render my report. I am not using any...
       · Hi,I tried to use this code but i got an error "A data source instance has not...
     

    ASP.NET ARTICLES

    - Disadvantages of the ASP.NET MVC Framework
    - Advantages of the ASP.NET MVC Approach
    - ASP.NET Web Forms Weaknesses
    - ASP.NET Web Forms Meets ASP.NET MVC
    - Source Code for Saving and Retrieving Data w...
    - Using GridView to Save and Retrieve Data wit...
    - Handling Dynamic Images in ASP.NET 3.5 AJAX ...
    - Retrieving Data with AJAX and the GridView C...
    - Playing with Images in ASP.NET 3.5 AJAX Appl...
    - Saving and Retrieving Data with AJAX
    - Enhancing PHP Via the ASP.NET AJAX Framework...
    - Enhancing PHP Programming with the ASP.NET A...
    - Classes and ASP.NET AJAX
    - Using ASP.NET AJAX
    - Building a Simple Storefront with LINQ





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
    Stay green...Green IT