Examples of Crystal Reports for Web pages

Source: Internet
Author: User
web| Crystal Report | page///customnav.aspx
<%@ Register tagprefix= "Crystalreports" namespace= "Seagatesoftware.web" assembly= "Seagatesoftware.web"%>
<%@ Page src= "CustomNav.cs" inherits= "Crsamples.customnav"%>


<body>

<form method= "POST" runat= "Server" >
<center>
<font face= "Verdana" Size=4>custom navigation</font><br>
<table border= "0" width= "90%" >
<tr><td>
<p align= "Justify" ><font face= "Verdana" size= "1" >
The default navigation method for the Crystal Reports Web Form Viewer control is the Toolbar
Panel. However, Web developers can create their own navigation for the. In
The example below, the Toolbar is hidden, and the user navigates the "the" by clicking image
button controls in the navigation bar along the left side of the page. This is provides for a very
Customizable interface to suit any Web site. This also demonstrates the Web Form Viewer
Can respond to the events fired by the other Web Controls easily.
</font>
</td></tr>
</table>
<br>
<table border= "0" width= "90%" >
<tr>
&LT;TD valign= "Top" bgcolor= "#bfa57d" width= "230" >
<font face= "Arial" size= "3" color= "White" ><b><i>xtreme Mountain bikes</i><br>
<font size= "2" >customer profile</b></font><br><br><br>
<font size= "1" > <b>change pages</b></font><br>
<asp:imagebutton id= "btnFirstPage" runat= "Server" imageurl= "Images/first_page.gif" tooltip= "the" "The" "A", "" "/>
<asp:imagebutton id= "Btnprevpage" runat= "Server" imageurl= "Images/prev_page.gif" tooltip= "Previous page"/>
<asp:imagebutton id= "Btnnextpage" runat= "Server" imageurl= "Images/next_page.gif" tooltip= "next page"/>
<asp:imagebutton id= "Btnlastpage" runat= "Server" imageurl= "Images/last_page.gif" tooltip= "last Page"/>
<br><br>
<font size= "1" >&nbspsearch for text<br></font>
<asp:textbox id= "Txtsearch" runat= "Server" width= "M"/>
<asp:button id= "btnsearch" runat= "Server" height= "Search" text=
</font>
</td>
&LT;TD valign= "Top" align= "Middle" >
<crystalreports:crystalreportviewer id= "CrystalReportViewer1" runat= "Server" width= "350px" height= "50px" Pagetotreeratio= "4"
Displaytoolbar= "false" displaygrouptree= "false"/>
</td>
</tr>
</table>
</center>
</form>

</body>


Customnav.cs
Using System;
Using System.Web.UI;
Using System.Web.UI.WebControls;
Using Microsoft.Win32;
Using Seagatesoftware.web;
Using System.Web.UI.WebControls;

Namespace Crsamples
{
public class CustomNav:System.Web.UI.Page
{
protected Crystalreportviewer CrystalReportViewer1;
protected ImageButton btnfirstpage;
protected ImageButton btnprevpage;
protected ImageButton btnnextpage;
protected ImageButton btnlastpage;
protected TextBox Txtsearch;
protected Button btnsearch;

protected void Page_Init (object sender, EventArgs e)
{
Btnfirstpage.click + = new Imageclickeventhandler (This.btnfirstpage_click);
Btnprevpage.click + = new Imageclickeventhandler (This.btnprevpage_click);
Btnnextpage.click + = new Imageclickeventhandler (This.btnnextpage_click);
Btnlastpage.click + = new Imageclickeventhandler (This.btnlastpage_click);
Btnsearch.click + = new EventHandler (This.btnsearch_click);

Crystalreportviewer1.reportname = Getsamplereportsdir () + "Feature examples\\sort multiple Field.rpt";
}

protected void Btnprevpage_click (object source, ImageClickEventArgs e)
{
Pagenavigateeventargs Pagenavevtargs = new Pagenavigateeventargs ();
Pagenavevtargs.newpagenumber = crystalreportviewer1.pagerequestcontext.pagenumber-1;
Crystalreportviewer1.onpagenavigate (source, Pagenavevtargs);
}

protected void Btnnextpage_click (object source, ImageClickEventArgs e)
{
Pagenavigateeventargs Pagenavevtargs = new Pagenavigateeventargs ();
Pagenavevtargs.newpagenumber = CrystalReportViewer1.PageRequestContext.PageNumber + 1;
Crystalreportviewer1.onpagenavigate (source, Pagenavevtargs);
}

protected void Btnfirstpage_click (object source, ImageClickEventArgs e)
{
Pagenavigateeventargs Pagenavevtargs = new Pagenavigateeventargs ();
Pagenavevtargs.newpagenumber = 1;
Crystalreportviewer1.onpagenavigate (source, Pagenavevtargs);
}

protected void Btnlastpage_click (object source, ImageClickEventArgs e)
{
Pagenavigateeventargs Pagenavevtargs = new Pagenavigateeventargs ();
Pagenavevtargs.newpagenumber = CrystalReportViewer1.PageViewer.LastPageNumber;
Crystalreportviewer1.onpagenavigate (source, Pagenavevtargs);
}

protected void btnSearch_Click (object source, EventArgs e)
{
Searcheventargs Searchevtargs = new Searcheventargs ();
Searchevtargs.texttosearch = Txtsearch.text;
Searchevtargs.pagenumbertobeginsearch = CrystalReportViewer1.PageRequestContext.PageNumber;
Crystalreportviewer1.onsearch (source, Searchevtargs);
}

Private String Getsamplereportsdir ()
{
Get the path VS. Is installed to
RegistryKey RegKey = registry.localmachine;
RegKey = Regkey.opensubkey ("Software\\microsoft\\visualstudio\\7.0\\setup\\vs");
String dir = Regkey.getvalue ("Productdir"). ToString ();
dir = = "Crystal reports\\samples\\reports\\";
return dir;
}
}
}


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.