What I would like to do is when a user clicks on a GridHyperLinkColumn within the radGrid, the default behavior is to be prompted with the "Save As" dialog. Thus far I have been unsuccessful in doing this. Attempted to use the HTML5 download option but GridHyperLinkColumn doesn't understand that. This is my current code but it doesn't work on every file as some open up. The file types may be varied (PDF, XLS, XLSX, DOC, DOCX, TXT, ZIP). Would it be possible to display a RadContextMenu when clicking on the link with "Save As" the only option?
<
telerik:GridHyperLinkColumn
SortExpression
=
"FileName"
DataTextFormatString
=
"{0}"
DataNavigateUrlFields
=
"file_name"
UniqueName
=
"file_name"
DataNavigateUrlFormatString
=
"/Repository/FTPCloud/{0}"
HeaderText
=
"File"
DataTextField
=
"file_name"
>
</
telerik:GridHyperLinkColumn
>
Private
Sub
grdCloudFiles_ItemDataBound(sender
As
Object
, e
As
GridItemEventArgs)
Handles
grdCloudFiles.ItemDataBound
If
TypeOf
e.Item
Is
GridDataItem
Then
Dim
item
As
GridDataItem =
DirectCast
(e.Item, GridDataItem)
Dim
link
As
HyperLink =
DirectCast
(item(
"file_name"
).Controls(0), HyperLink)
link.Attributes.Add(
"onclick"
,
String
.Format(
"javascript:document.execCommand('SaveAs','true','{0}');"
, MapPath(
"."
) & link.NavigateUrl))
End
If
End
Sub