I have the following column in a GridView, and my problem is that it only renders the text ‘Download’, not a URL.
<asp:HyperLinkField DataNavigateUrlFields='ArchiveLocation' Text='Download' DataNavigateUrlFormatString='{0}' />
When I bind a DataTable with one row to the grid, the ArchiveLocation in that row contains the value:
‘~/Common/Forms/ExportStream.aspx?path=C:\Development\Chase\Exports\ChaseExport-090312073930.zip’.
Use the NavigateUrl only if you want the same URL for all records.
It appears that the HyperLinkField renders text only if there is a colon in the field’s value. Remove the colon and you will see hyper links. I don’t know why yet.
Apparently, the OnDataBindField method calls CrossSiteScriptingValidation.IsDangerousUrl which considers ‘:’ dangerous on your behalf: