ASP.NET
  Home arrow ASP.NET arrow Extending an ASP.NET Datagrid to Support S...
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 
Dedicated Servers 
Moblin 
JMSL Numerical Library 
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

Extending an ASP.NET Datagrid to Support Simple Cross Tab Reporting: The Structure
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 12
    2006-02-27

    Table of Contents:
  • Extending an ASP.NET Datagrid to Support Simple Cross Tab Reporting: The Structure
  • The enumerations declared in the custom control
  • The properties available to customize the custom control
  • The core database routines

  • 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


    Extending an ASP.NET Datagrid to Support Simple Cross Tab Reporting: The Structure


    (Page 1 of 4 )

    This article guides you through developing your own ASP.NET custom control by extending the existing datagrid control (in ASP.NET). It mainly concentrates on Cross Tab Reporting with the ASP.NET data grid.
    A downloadable file for this article is available here.

    If you are very new to developing ASP.NET custom controls, I suggest you refer to my long series titled “ASP.NET custom server controls.” It would definitely help you in working with some fundamental custom controls.

    The entire source code is developed using Visual Studio.NET 2003 Enterprise Architect with SQL Server 2000 enterprise edition on Windows Server 2003 standard edition.  I didn’t really test the source code in any of the previous releases or later releases apart from the above.  Please drop me a line if you really want it customized with any of the later releases along with some suggestions for features or enhancements you want.

    I strongly suggest you customize the custom control to suit your needs.

    What is inside my custom control?

    I was really expecting some new server controls from Microsoft to support cross tab reporting.  Instead, Microsoft offers that option only through SQL Server Reporting Services or Crystal Reports.  Apart from those two technologies (and third-party vendors), there exists no control to support a cross-tab reporting system.

    But I'm still happy with the flexibility that Microsoft offered with datagrid. It really has enormous depth; we just need to use our skill to mold it according to our requirements.  Finally, I started with a simple cross tab control (by extending it from datagrid) to support basic cross tabbing. To my surprise, it really worked as I expected.  Even though it may not be very useful for enterprise reporting, I can still use it for small cross-tab reports.  And there is always a chance for extensibility.

    Coming to my custom control, it has a region called “Core Database Routines,” which is very similar to DAL.  It is just a small interpretation of the same. The region contains the following methods within it: 

    • getRowValue
    • getDataTable
    • SPgetDataTable
    • SPaddParameter

    Those are the methods I mostly used to work with the custom control.  The first two shall work directly with the tables, and the last two work with stored procedures.

    Apart from the above, I also developed one more class to handle all parameters (or parameter caches) which are likely to be passed to stored procedures.  It is named “MSSQLProcParameter.”  Even though it is not necessary, it eased some of my problems.

    Not only that, I declared three more enumerations, especially to provide properties.  Those are as follows:

    • OperationType (could be sum, avg, etc.)
    • ObjectType (could be either table or stored procedure)
    • MSSQLDataType (my own mapping of data types)

    I could not finish without giving several additional properties to the custom control as it is related to the cross tab.  The following is the list of properties I managed to declare:

    • ObjectName
    • TypeOfObject
    • RowFieldName
    • ColFieldName
    • SummaryFieldName
    • TypeOfOpeation
    • AdditionalBlankColumns

    And finally, I managed to get entire thing working with a simple method, named “LoadData.”

    That gives you an overall idea of the inner workings of the custom control.  Now let us delve into the details.

    More ASP.NET Articles
    More By Jagadish Chaterjee


       · Hi guys, do you ever need a cross tab feature with a data grid? Here is the...
     

    ASP.NET ARTICLES

    - 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
    - Developing a Dice Game Using ASP.NET Futures...
    - Completing an ASP.NET AJAX Server-Centric Ba...
    - Information Management for an ASP.NET AJAX S...
    - Comment and Order Management for an ASP.NET ...
    - Back-end Management Tasks for an ASP.NET AJA...
    - User Information Management for an ASP.NET A...
    - Adding Comments and Search to an ASP.NET AJA...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway