Back to Devexpress

XRControl.Bookmark Property

xtrareports-devexpress-dot-xtrareports-dot-ui-dot-xrcontrol-8891a7a1.md

latest5.3 KB
Original Source

XRControl.Bookmark Property

Bindable. Gets or sets the text of a bookmark for this control.

Namespace : DevExpress.XtraReports.UI

Assembly : DevExpress.XtraReports.v25.2.dll

NuGet Package : DevExpress.Reporting.Core

Declaration

csharp
[XRLocalizable(true)]
[SRCategory(ReportStringId.CatNavigation)]
public virtual string Bookmark { get; set; }
vb
<XRLocalizable(True)>
<SRCategory(ReportStringId.CatNavigation)>
Public Overridable Property Bookmark As String

Property Value

TypeDescription
String

A String representing the bookmark’s text which is shown in the report’s document map.

|

Remarks

Use this property to specify the string shown as a bookmark’s text. Note, that the Bookmark property is bindable. This means that an XRControl object can have several bookmark instances shown in the report’s document map. Also, set the XRControl.BookmarkParent property to specify a parent bookmark for the current bookmark. These two properties are used to create a report’s document map.

For more information on using bookmarks in XtraReports see the Adding Bookmarks and a Document Map document.

Note

The Bookmark property is bindable, which means that it can be bound to a data field in a report’s data source. To learn more, see the Binding Report Controls to Data section.

Not all descendants of the XRControl class use the Bookmark property. For example, the Band class descendants ignore the Bookmark property.

Example

This example demonstrates how to create a document map with bookmarks for each page in a report.

To implement a document map in your report, do the following.

  1. To create a table report, start with a report that is bound to the “Products” table of the sample Northwind database. To learn more about binding a report to a data source, see Providing Data to Reports.

  2. Set the report’s XtraReport.Bookmark property to “Table of Contents”.

  3. To create the report’s main content, drop the ProductName field from the Field List onto the report’s Detail band.

  4. Insert a ReportHeaderBand. To do this, right-click anywhere in the report designer, and in the invoked context menu point to Insert Band , and then click ReportHeader.

  5. Insert a PageHeaderBand. To do this, right-click anywhere in the report designer, and in the context menu, point to Insert Band , and then click PageHeader.

csharp
using System;
using DevExpress.XtraReports.UI;
// ...

private void xrLabel3_PrintOnPage(object sender, PrintOnPageEventArgs e) {
    // Obtain the current page number.
    string s = (e.PageIndex + 1).ToString();

    // Set the label's text and bookmark (this label is located on the PageHeader
    // band, so it will show a bookmark for every report page
    ((XRLabel)sender).Bookmark += s;
    ((XRLabel)sender).Text += s;
}
vb
Imports System
Imports DevExpress.XtraReports.UI
' ...

Private Sub xrLabel3_PrintOnPage(ByVal sender As Object, _ 
ByVal e As PrintOnPageEventArgs) Handles xrLabel2.PrintOnPage
    ' Obtain the current page number.
    Dim s As String = (e.PageIndex + 1).ToString()

    ' Set the label's text and bookmark (this label is located on the PageHeader
    ' band, so it will show a bookmark for every report page
    CType(sender, XRLabel).Bookmark += s
    CType(sender, XRLabel).Text += s
End Sub

See Also

XRControl Class

XRControl Members

DevExpress.XtraReports.UI Namespace