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.v20.2.dll

Declaration

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

Property Value

Type Default Description
String

String.Empty

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.

Remarks

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 _blank.
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 use the XRLabel control to create a hyperlink.

The code below creates the XRLabel control, sets up its appearance, and specifies its NavigateUrl and Target 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;
}

To add the hyperlink to the report's Detail band, handle the report's BeforePrint event:

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 label behaves like a hyperlink in a report's Print Preview and in a document exported to HTML, PDF, RTF, XLS, and XLSX formats.

See Also