C#
  Home arrow C# arrow Page 3 - Creating Graphical Reports With Crystal Re...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Moblin 
JMSL Numerical Library 
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? 
C#

Creating Graphical Reports With Crystal Reports in .NET
By: Wrox Team
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 153
    2002-11-10

    Table of Contents:
  • Creating Graphical Reports With Crystal Reports in .NET
  • The Database
  • Creating Web Pages
  • The Report
  • Creating Report Parameters
  • Passing Parameters to a Report
  • Conclusion

  • 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


    Creating Graphical Reports With Crystal Reports in .NET - Creating Web Pages


    (Page 3 of 7 )

    So let us look at our first aspx page, index.aspx. This is the page that the sales person will use to login into our system. You will find the code in the download.



    This page consists of two text boxes to take a user name and password, and a submit button. If the user is valid we redirect them to the PostEntry.aspx page with their SalesPersonId in the query string.



    Here the sales person selects the item they have sold and enters its amount, which is then added in the database. After that we simply return them back to the login page with a thanks message.

    Up until now we have just discussed entering the data into our database. Now we will look at the reports of this data.

    We create a page called ManagerDefault.aspx where a manager can make custom reports. Here is how it looks:



    First the manager selects the Item they want a report on, then they select the date range for which they want to view data. We use ASP.NET Calendar controls to do this:



    We also include an option to view the report either in Graph or List form.

    This page is simple. The point of interest is the usage of calendar control. Let us first see what additions are made in the ManagerDefault.aspx file after adding the calendar control, then we will come to the code behind.

    <asp:calendar id="DtPicker2" runat="Server" Height="156px" Width="280px" Visible="False" BackColor="White"
    SelectorStyle-BackColor="#FFCC66" NextPrevStyle-Font-Size="9pt" NextPrevStyle- ForeColor="#FFFFCC"
    TodayDayStyle-ForeColor="White" TodayDayStyle-BackColor="#FFCC66" DayHeaderStyle-Height="1px"
    DayHeaderStyle-BackColor="#FFCC66" BorderWidth="1px" Font-Size="9pt" Font-Names="Verdana"
    OtherMonthDayStyle-ForeColor="#CC9966" TitleStyle-Font-Size="9pt" TitleStyle-Font-Bold="True"
    TitleStyle-ForeColor="#FFFFCC" TitleStyle-BackColor="#990000" ForeColor="Black"
    BorderColor="White" SelectedDayStyle-Font-Bold="True" SelectedDayStyle-BackColor="#CCCCFF"
    NextPrevFormat="FullMonth">


    This stuff is for the calendar and as this calendar is displayed by clicking the image, here is the code for the image also in the same file.

    <input type="image" onclick="Page_ValidationActive=false;" src="datepicker.gif" alt="Show Calender"
    runat="server" onserverclick="ShowCal1" id="ImgCal1" name="ImgCal1">


    Here we set the Page_ValidationActive variable to false so that we don't post the form, and perform validation on clicking the image. Secondly, notice onserverclick="ShowCal1". This ShowCal1() method is available in the code behind file ManagerDefault.aspx.cs.

    Next we come to the code behind file ManagerDefault.aspx.cs. We will only cover the calendar related functions here. The method below displays the calendar, and is invoked when the calendar image is clicked:

    // this method displays the first date calendar
    public void ShowCal1(Object sender, System.Web.UI.ImageClickEventArgs e)
    {
    // Display calendar
    DtPicker1.Visible = true;
    }


    When the user clicks on the calendar to select a date, we move the selected date to its text box and hide the calendar.

    // this method get the first date and hide the first calendar
    private void DtPicker1_SelectionChanged(object sender, System.EventArgs e)
    {
    txtStartDate.Text = DtPicker1.SelectedDate.ToShortDateString();
    DtPicker1.Visible = false;
    }


    The second calendar is handled in the same way.

    Once the manager has made their selections, they press the ShowReport button. Here is how we deal with it:

    // this method redirects the manager to Report page with the selected items
    private void bSubmit_ServerClick(object sender, System.EventArgs e)
    {
    // redirect to the report page
    Response.Redirect("ViewReport.aspx?ItemId=" + cboItemType.SelectedItem.Value + "&StartDate=" +
    txtStartDate.Text + "&EndDate=" + txtEndDate.Text);

    }


    We simply redirect the user to the ViewReport.aspx page and send all the inputs as parameters like the ItemId, StartDate and the EndDate.

    ViewReport.aspx does all of the work for displaying the report. Let's talk about it now.

    More C# Articles
    More By Wrox Team


       · Hello i want to download the code for following topic.Creating Graphical Reports...
       · best one to know the technical details
       · good one for starting..
       · How can i download source of this article..
       · best is to start lowr level to higher level;
     

    C# ARTICLES

    - Introduction to Objects and Classes in C#, P...
    - Visual C#.NET, Part 1: Introduction to Progr...
    - C# - An Introduction
    - Hotmail Exposed: Access Hotmail using C#
    - Razor Sharp C#
    - Introduction to Objects and Classes in C#
    - Making Your Code CLS Compliant
    - Programming with MySQL and .NET Technologies
    - Socket Programming in C# - Part II
    - Socket Programming in C# - Part I
    - Creational Patterns in C#
    - Type Conversions
    - Creating Custom Delegates and Events in C#
    - Inheritance and Polymorphism
    - Understanding Properties in C#






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