Fired when the value of the CurrentPage property changes.
Namespace:
C1.Web.C1WebReportAssembly: C1.Web.C1WebReport.2 (in C1.Web.C1WebReport.2.dll)
Syntax
C# |
---|
public event EventHandler CurrentPageChanged |
Visual Basic (Declaration) |
---|
Public Event CurrentPageChanged As EventHandler |
Remarks
This event is useful when you want to implement custom navigation bars and need to
update the display to show the number of the page being displayed.
Examples
The following code uses the CurrentPageChanged event to enable or disable the navigation buttons and to update the current page/page count display:
Copy CodeVisual Basic
' update bar state after page changesPrivateSub _c1wr_CurrentPageChanged(sender AsObject, e As System.EventArgs) Dim curr AsInteger = _c1wr.CurrentPage Dim cnt AsInteger = _c1wr.PageCount ' show/hide navigation buttons _btnFirst.Visible = (curr > 1) _btnPrev.Visible = (curr > 1) _btnLast.Visible = (curr < cnt) _btnNext.Visible = (curr < cnt) _btnJump.Visible = (cnt > 1) _txtPage.Visible = (cnt > 1) ' update labelDim str AsString = String.Format("This is page {0} of {1}", curr, cnt) If curr = 1Then str = "This is the first page."ElseIf curr = cnt Then str = String.Format("This is the last page ({0}).", cnt) EndIfEndIf _lblCurrent.Text = str EndSub |
Copy CodeC#
// update bar state after page changesprivatevoid _c1wr_CurrentPageChanged(object sender, System.EventArgs e) { int curr = _c1wr.CurrentPage; int cnt = _c1wr.PageCount; // show/hide navigation buttons _btnFirst.Visible = _btnPrev.Visible = (curr > 1); _btnLast.Visible = _btnNext.Visible = (curr < cnt); _btnJump.Visible = _txtPage.Visible = (cnt > 1); // update labelstring str = string.Format("This is page {0} of {1}", curr, cnt); if (curr == 1) str = "This is the first page."; elseif (curr == cnt) str = string.Format("This is the last page ({0}).", cnt); _lblCurrent.Text = str; } |