This example demonstrates how to configure a grid column's data item template to display a hyperlink based on several cell values.
For an example on how to implement a similar functionality based on an unbound GridViewDataHyperLinkColumn, refer to the following example: Grid View for ASP.NET Web Forms - How to create a HyperLink column whose URL depends on several column values
The example application illustrates a common use case scenario when values from several data fields are used to generate the URL and/or display text of a hyperlink displayed within a grid cell.
Two equivalent techniques are demonstrated:
-
Based on the ASPxHyperLink control. The control's NavigateUrl property value includes the processed row's KeyValue property value.
-
Based on the
<a>
HTML element. The serverGetRowValue
method calculates thehref
parameter's value.
- Default.aspx (VB: Default.aspx)
- Default.aspx.cs (VB: Default.aspx.vb)