日期:2013-10-08  浏览次数:20449 次

///customnav.aspx
<%@ Register TagPrefix="CrystalReports" Namespace="SeagateSoftware.Web" Assembly="SeagateSoftware.Web" %>
<%@ Page Src="CustomNav.cs" Inherits="CRSamples.CustomNav" %>

<html>

<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 interface for the report. In
the example below, the Toolbar is hidden, and the user navigates the report by clicking image
button controls in the navigation bar along the left side of the page. This provides for a very
customizable interface to suit any web site. This also demonstrates how the Web Form Viewer
can respond to events fired by other Web Controls easily.
</font>
</td></tr>
</table>
<br>
<table border="0" width="90%">
<tr>
<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="First Page"/> 
<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"> Search for Text<br></font>
<asp:TextBox id="txtSearch" runat="server" width="100"/>
<asp:Button id="btnSearch" runat="server" height="22" Text="Search"/>
</font>
</td>
<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>

</html>

///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;
 &n