I have a gridview inside of an updatepanel. Within the gridview I have a column with an imagebutton that when clicked will execute a sub that will respond back with a response.binarywrite allowing a person to download a pdf file; however, when clicked it comes back with a response.write error.
I know I may need triggers, but I am having some difficulty. I am currently registering the imagebutton on rowdatabound, but it doesn't seem to be doing anything.
This is is what I have in the codebehind.
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
If DotNetNuke.Framework.AJAX.IsInstalled Then
Dim imageButton As ImageButton = CType(e.Row.FindControl("DownloadFile"), ImageButton)
DotNetNuke.Framework.AJAX.RegisterPostBackControl(imageButton)
End If
Sub End
<asp:UpdatePanel ID="updatePanel" runat="server">
<Triggers>
</Triggers>
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server" OnPageIndexChanging="gridView1_PageIndexChanging" OnRowDataBound="GridView1_RowDataBound" AutoGenerateColumns="False" AllowPaging="True" AllowSorting="false" CellPadding="1" cellspacing="0" PageSize="10" HeaderStyle-BackColor="#CCDDEE" Width="100%" CssClass="GridTable" GridLines="Horizontal" BorderColor="#CECED8">
<Columns>
<asp:TemplateField HeaderText="" ItemStyle-CssClass="normal" HeaderStyle-Width="5" ItemStyle-Width="5" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<span style="color:gray"><%# Container.DataItemIndex + 1 %>.</span>
</ItemTemplate></asp:TemplateField><asp:templatefield ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" HeaderText="" HeaderStyle-CssClass="NormalBold" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Wrap="false" HeaderStyle-Width="16" ItemStyle-Width="16">
<itemtemplate>
<asp:ImageButton OnCommand="DownLoadFile_Command" id="DownloadFile" runat="server" CssClass="CommandButton" CommandArgument='<%# Eval("ID") %>' visible="true" ImageUrl="~/images/download.gif" AlternateText="Download This Document" CausesValidation="false" />
</itemtemplate>
</asp:templatefield>
</Columns>
<RowStyle BackColor="#FFFFFF" />
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>