|
There seems to be a subtle difference between the way the GridView’s HyperLinkColumn
behaves when the hyperlink is a javascript (instead of a Url) and the way the DataGrid’s
HyperLinkColumn used to behave.
In this demo I tried 4 scenarios:
- A HyperLinkField within a GridView: where I set the DataNavigateUrlFormatString="javascript:alert('you
selected {0}');"
- A HyperLink within an ItemTemplate inside a GridView; where I set the NavigateUrl='<%#
FormatLink(Eval("Text")) %>'
- A regular anchor tag (runat=”server”) within an ItemTemplate inside the GridView
where I set the href='<%# FormatLink(Eval("Text")) %>'
- The HyperLinkColumn within a DataGrid where I set the DataNavigateUrlFormatString="javascript:alert('you
selected {0}');"
The last 3 scenarios work but the first does not.
|
This GridView demonstrates the first 3 scenarios in corresponding 3 columns
|
|
This DataGrid represents the last scenario
|
|