ASP.NET.in.a.Nutshell.Second.Edition [Electronic resources]

G. andrew Duthie; matthew Macdonald

نسخه متنی -صفحه : 873/ 767
نمايش فراداده

HyperLinkColumn

System.Web.UI.WebControls (system.web.dll)class

The HyperLinkColumn class represents a column that can be used in a DataGrid control. To have a column with the same hyperlink in every row, you can set Text (the displayed anchor text) and NavigateUrl (the link destination). Alternatively, you can bind a data field to the DataTextField and DataNavigateUrlField properties (which will then take precedence over any set values for the Text and NavigateUrl properties). Typically, this information will be specified by using a data binding expression in a template definition in the .aspx file.

Additionally, you can set the Target property to indicate the target window or frame name for the hyperlink. You can also use the DataTextFormatString property to provide a custom format string to use with the DataTextField property.

public class 

HyperLinkColumn : DataGridColumn { // Public Constructors public

HyperLinkColumn ( ); // Public Instance Properties public virtual string

DataNavigateUrlField {set; get; } public virtual string

DataNavigateUrlFormatString {set; get; } public virtual string

DataTextField {set; get; } public virtual string

DataTextFormatString {set; get; } public virtual string

NavigateUrl {set; get; } public virtual string

Target {set; get; } public virtual string

Text {set; get; } // Public Instance Methods public override void

Initialize ( ); // overrides DataGridColumn public override void

InitializeCell (TableCell

cell , int

columnIndex , ListItemType

itemType ); // overrides DataGridColumn // Protected Instance Methods protected virtual string

FormatDataNavigateUrlValue (object

dataUrlValue ); protected virtual string

FormatDataTextValue (object

dataTextValue ); }

Hierarchy

System.Object DataGridColumn(System.Web.UI.IStateManager) HyperLinkColumn