asp.net.ph

HyperLinkField.DataNavigateUrlFields Property

System.Web.UI.WebControls Namespace   HyperLinkField Class


.NET Framework version 2.0

Sets or retrieves the fields from a data source to bind to the URL of the hyperlinks in a HyperLinkField.

Syntax


Inline <asp:hyperlinkfield datanavigateurlfields = strField1, strField2 ... >
Script HyperLinkField.DataNavigateUrlFields = strField1, strField2 ...

Property Value


strFieldName An array specifying the names of the fields from a data source to bind to the URL of the hyperlinks in the column.

The property is read/write with no default value.

Remarks

Use the DataNavigateUrlFields property to specify or determine the field names from a data source to bind to the URL of the hyperlinks in a HyperLinkField.

NOTE: The specified field name must point to a field in the data source bound to the column's parent control, such as the GridView control. The properties of a HyperLinkField cannot be bound to a data source other than the parent control's data source.

When this property is set, the URL for each hyperlink in the column is set to the corresponding row values in the specified fields from the data source bound to the parent control. This allows setting a different URL for each hyperlink in the column. To specify the same URL for all hyperlinks, set the NavigateUrl property instead.

NOTE: The DataNavigateUrlFields and NavigateUrl properties cannot both be set at the same time. If both properties are set, the DataNavigateUrlFields property takes precedence.

When using data binding, you can specify a custom display format for the hyperlink URLs by setting the DataNavigateUrlFormatString property.

Example

The following examples demonstrate how to set the DataNavigateUrlFields property to dynamically set different URLs in a HyperLinkField at run time.

GridView HyperLinkField Example
Run Sample | View Source
Dynamically Generated HyperLinkField Images
Run Sample | View Source
See Also

HyperLinkField Members   Adding HyperLink Fields to a GridView Control Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph