XRControl.Target Property

Specifies the target window or frame in which to display the linked Web page's content, when the control is clicked.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v18.2.dll

Declaration

[SRCategory(ReportStringId.CatNavigation)]
public virtual string Target { get; set; }
<SRCategory(ReportStringId.CatNavigation)>
Public Overridable Property Target As String

Property Value

Type Description
String

A String which identifies the window or frame at which to target the URL's content. Its values must begin with a letter in the range a through to z (case insensitive), except for the following special values, which begin with an underscore.

When an XRControl object is clicked and its XRControl.NavigateUrl property is defined, a Web browser navigates to the URL specified by the latter, and displays it in the window or frame, as specified by the Target property. The available values of this property are listed in the table below.

Member Description
empty string Default. If the Target property is not set, the behavior is similar if the Target property is set to _self.
name The name of the target window or frame.
_blank Loads the linked document into a new blank window. This window is not named.
_parent Loads the linked document into the immediate parent of the document containing the link.
_search Loads the linked document into the browser search pane. Available in Internet Explorer 5 or later.
_self Loads the linked document into the window in which the link was clicked (the active window).
_top Loads the linked document into the topmost window.

Examples

This example demonstrates how to create a hyperlink in a report. Note that such label behaves as a hyperlink both in a report's Print Preview and HTML, PDF, RTF, XLS and XLSX formats.

To add a hyperlink, to the Report Detail Band, handle the Report's XRControl.BeforePrint event in the following way.

using DevExpress.XtraReports.UI;
// ...

private void XtraReport1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) {
    // Create a new hyperlink and add it to the report's Detail Band.
    Bands.GetBandByType(typeof(DetailBand)).Controls.Add(CreateHyperlink());
}

The code below creates a hyperlink using the XRLabel object, and specifies its XRControl.NavigateUrl, XRControl.Target and other properties.

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

public XRLabel CreateHyperlink(){
    // Create a label for a hyperlink.
    XRLabel hyperlinkLabel = new XRLabel();

    // Set its main properties.
    hyperlinkLabel.Text = "DevExpress Inc.";
    hyperlinkLabel.Width = 200;
    hyperlinkLabel.ForeColor = Color.Blue;
    hyperlinkLabel.Font = new Font("Tahoma", 12, FontStyle.Underline);

    // Set its URL and target.
    hyperlinkLabel.NavigateUrl = "http://www.devexpress.com";
    hyperlinkLabel.Target = "_blank";

    return hyperlinkLabel;
}

See Also