System.Web.UI.WebControls.HyperLinkColumn Class

A column type for the System.Web.UI.WebControls.DataGrid control that contains a hyperlink for each item in the column.

See Also: HyperLinkColumn Members


public class HyperLinkColumn : DataGridColumn


Use the System.Web.UI.WebControls.HyperLinkColumn column type in a System.Web.UI.WebControls.DataGrid control to create a hyperlink for each row in the System.Web.UI.WebControls.DataGrid. Set the HyperLinkColumn.Text property to specify the caption text for the hyperlink. To specify the URL to link to when the hyperlink is clicked, set the HyperLinkColumn.NavigateUrl property.


If you set the HyperLinkColumn.Text and HyperLinkColumn.NavigateUrl properties, all hyperlinks in the column will share the same caption and URL.

You can also bind the text caption and URL of the hyperlinks in the System.Web.UI.WebControls.HyperLinkColumn to a field in a data source instead of setting the ButtonColumn.Text and HyperLinkColumn.NavigateUrl properties. This allows you to display a different caption and to specify a different URL for each hyperlink in the column.

Use the HyperLinkColumn.DataTextField property to specify a field in a data source to bind to the text caption of the hyperlinks in the column.


The HyperLinkColumn.DataTextField and HyperLinkColumn.Text properties cannot both be set at the same time. If both properties are set, the HyperLinkColumn.DataTextField property takes precedence.

Specify the field to bind to the URL of the hyperlink by setting the HyperLinkColumn.DataNavigateUrlField property.


The HyperLinkColumn.DataNavigateUrlField and HyperLinkColumn.NavigateUrl properties cannot both be set at the same time. If both properties are set, the HyperLinkColumn.DataNavigateUrlField property takes precedence.

The HyperLinkColumn.Target property allows you to specify the window or frame to display the Web page content linked to when the hyperlink is clicked.

When using data binding, you can format the text caption and URL of the hyperlink by setting the HyperLinkColumn.DataTextFormatString and HyperLinkColumn.DataNavigateUrlFormatString properties, respectively.


This control can be used to display user input, which might include malicious client script. Check any information that is sent from a client for executable script, SQL statements, or other code before displaying it in your application. You can use validation controls to verify user input before displaying the input text in a control. ASP.NET provides an input request validation feature to block script and HTML in user input. For more information, see Securing Standard ControlsHow to: Protect Against Script Exploits in a Web Application by Applying HTML Encoding to Strings, and Introduction to Validating User Input in ASP.NET Web Pages.


Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 1.0.5000.0,