Programming Crystal Reports with ASP.NET 2.0 - Hiding the toolbar and adding First, Last, Next and Previous page buttons to the report
(Page 5 of 6 )
By default, CrystalReportViewer automatically displays toolbar at the top. Not every end user uses all features. At the same time, some end users may not like the toolbar.
To hide the toolbar, modify the CrystalReportViewer code (in Source mode) as follows:
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="True" ReuseParameterValuesOnRefresh="True" DisplayToolbar="False" EnableDatabaseLogonPrompt="False" EnableParameterPrompt="False" DisplayGroupTree="False"
Height="1064px" ReportSourceID="CrystalReportSource1" Width="928px" />
Add First, Last, Next and Previous page buttons to the web page and modify the code behind with new events as follows:
Protected Sub btnFirst_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnFirst.Click
Me.CrystalReportViewer1.ShowFirstPage()
End Sub
Protected Sub btnLast_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnLast.Click
Me.CrystalReportViewer1.ShowLastPage()
End Sub
Protected Sub btnNext_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnNext.Click
Me.CrystalReportViewer1.ShowNextPage()
End Sub
Protected Sub btnPrevious_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnPrevious.Click
Me.CrystalReportViewer1.ShowPreviousPage()
End Sub
Next: Enhancing the report with run-time binding along with session handling >>
More ASP.NET Articles
More By Jagadish Chaterjee