I have read several posts about how to do this. I have also reviewed the documentation but I still can't get it figured out. I have a grid with a template column containing a link button:
<
telerik:RadGrid
ID
=
"rg_ven_docs"
runat
=
"server"
DataSourceID
=
"sdc_rg_ven_docs"
AutoGenerateColumns
=
"False"
AllowPaging
=
"True"
AllowSorting
=
"True"
AllowFilteringByColumn
=
"True"
ShowGroupPanel
=
"True"
Skin
=
"Office2010Blue"
ClientSettings-EnablePostBackOnRowClick
=
"True"
CellSpacing
=
"-1"
GridLines
=
"Both"
OnSelectedIndexChanged
=
"rg_ven_docs_SelectedIndexChanged"
OnPreRender
=
"rg_ven_docs_PreRender"
OnItemCommand
=
"rg_ven_docs_ItemCommand"
EnableViewState
=
"true"
PageSize
=
"5"
>
<
ClientSettings
AllowDragToGroup
=
"True"
AllowColumnsReorder
=
"True"
ReorderColumnsOnClient
=
"True"
>
</
ClientSettings
>
<
MasterTableView
DataSourceID
=
"sdc_rg_ven_docs"
DataKeyNames
=
"docIdPk"
ShowHeadersWhenNoRecords
=
"true"
CommandItemDisplay
=
"Top"
CommandItemSettings-ShowAddNewRecordButton
=
"false"
CommandItemSettings-ShowRefreshButton
=
"true"
>
<
Columns
>
<
telerik:GridButtonColumn
Text
=
"Select"
CommandName
=
"Select"
ButtonType
=
"LinkButton"
></
telerik:GridButtonColumn
>
<
telerik:GridBoundColumn
DataField
=
"docIdPk"
ReadOnly
=
"True"
HeaderText
=
"docIdPk"
SortExpression
=
"docIdPk"
UniqueName
=
"docIdPk"
DataType
=
"System.Int32"
FilterControlAltText
=
"Filter docIdPk column"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"venDocTitle"
HeaderText
=
"Title"
SortExpression
=
"venDocTitle"
UniqueName
=
"venDocTitle"
FilterControlAltText
=
"Filter venDocTitle column"
HeaderStyle-HorizontalAlign
=
"Center"
ItemStyle-HorizontalAlign
=
"Center"
HeaderStyle-Font-Bold
=
"true"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"docType"
HeaderText
=
"Document Type"
SortExpression
=
"docType"
UniqueName
=
"docType"
FilterControlAltText
=
"Filter docType column"
HeaderStyle-HorizontalAlign
=
"Center"
ItemStyle-HorizontalAlign
=
"Center"
HeaderStyle-Font-Bold
=
"true"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"contType"
HeaderText
=
"Contract Type"
SortExpression
=
"contType"
UniqueName
=
"contType"
FilterControlAltText
=
"Filter contType column"
HeaderStyle-HorizontalAlign
=
"Center"
ItemStyle-HorizontalAlign
=
"Center"
HeaderStyle-Font-Bold
=
"true"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"org"
HeaderText
=
"Organization"
SortExpression
=
"org"
UniqueName
=
"org"
FilterControlAltText
=
"Filter org column"
HeaderStyle-HorizontalAlign
=
"Center"
ItemStyle-HorizontalAlign
=
"Center"
HeaderStyle-Font-Bold
=
"true"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"dept"
HeaderText
=
"Department"
SortExpression
=
"dept"
UniqueName
=
"dept"
FilterControlAltText
=
"Filter dept column"
HeaderStyle-HorizontalAlign
=
"Center"
ItemStyle-HorizontalAlign
=
"Center"
HeaderStyle-Font-Bold
=
"true"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"PriorContCd"
HeaderText
=
"Prior Contract Code"
SortExpression
=
"PriorContCd"
UniqueName
=
"PriorContCd"
FilterControlAltText
=
"Filter PriorContCd column"
HeaderStyle-HorizontalAlign
=
"Center"
ItemStyle-HorizontalAlign
=
"Center"
HeaderStyle-Font-Bold
=
"true"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"stat"
HeaderText
=
"Status"
SortExpression
=
"stat"
UniqueName
=
"stat"
FilterControlAltText
=
"Filter stat column"
HeaderStyle-HorizontalAlign
=
"Center"
ItemStyle-HorizontalAlign
=
"Center"
HeaderStyle-Font-Bold
=
"true"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"crntDocStatDtSet"
ReadOnly
=
"True"
HeaderText
=
"Status Date"
SortExpression
=
"crntDocStatDtSet"
UniqueName
=
"crntDocStatDtSet"
DataType
=
"System.DateTime"
FilterControlAltText
=
"Filter crntDocStatDtSet column"
HeaderStyle-HorizontalAlign
=
"Center"
ItemStyle-HorizontalAlign
=
"Center"
HeaderStyle-Font-Bold
=
"true"
></
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"venIdFk"
HeaderText
=
"venIdFk"
SortExpression
=
"venIdFk"
UniqueName
=
"venIdFk"
DataType
=
"System.Int32"
FilterControlAltText
=
"Filter venIdFk column"
ReadOnly
=
"true"
></
telerik:GridBoundColumn
>
<
telerik:GridTemplateColumn
DataField
=
"venDocPath"
HeaderText
=
"Download"
SortExpression
=
"venDocPath"
UniqueName
=
"venDocPath"
FilterControlAltText
=
"Filter venDocPath column"
>
<
ItemTemplate
>
<
asp:LinkButton
ID
=
"lnkDownload"
Text
=
"Download"
CommandArgument='<%# Eval("venDocPath") %>' runat="server" OnClick="lnkDownload_Click"></
asp:LinkButton
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
Here is the OnClick event of the link button:
protected
void
lnkDownload_Click(
object
sender, EventArgs e)
{
string
filePath = (sender
as
LinkButton).CommandArgument;
Response.ContentType = ContentType;
Response.AppendHeader(
"Content-Disposition"
,
"attachment; filename="
+ Path.GetFileName(filePath));
Response.WriteFile(filePath);
Response.End();
}
I am still unable to get the file to download.
I have tried the following as well, but I still couldn't get the file to download - Download File From Grid Column
I also reviewed this demo - Column Types in Grid
Any help would be greatly appreciated.
Thanks,
J