Hi ,
Please give me an idea why its executing catch block.
Error :
Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack
Code Behind Code:
try
{
string filePath = (sender as LinkButton).CommandArgument;
Response.ContentType = ContentType;
Response.AppendHeader("Content-Disposition", "attachment; filename=" + Path.GetFileName(filePath));
Response.WriteFile(filePath);
Response.End();
}
catch (ThreadAbortException lException)
{
// do nothing
}
catch (Exception ex)
{
throw ex;
}
Front End code in content place holder
<asp:GridView BorderStyle="Outset" BorderColor="#ddd" BorderWidth="1px" ShowHeader="False" ID="GridViewShowFiles" runat="server" AutoGenerateColumns="False" EmptyDataText="No files uploaded"
CellPadding="4" AlternatingRowStyle-BackColor="#dff0d8" RowStyle-BackColor="#dff0d8"
RowStyle-Height="40px"
GridLines="None" Width="100%">
<Columns>
<asp:BoundField DataField="Text" />
<asp:TemplateField ControlStyle-CssClass="pull-right">
<ItemTemplate>
<asp:LinkButton ID="lnkDownload" Text="Download" CommandArgument='<%# Eval("Value") %>' runat="server" OnClick="DownloadFile"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton CssClass=" pull-right" ID="lnkDelete" Text="" CommandArgument='<%# Eval("Value") %>'
runat="server" OnClick="DeleteFile">
<span title="Remove" class="glyphicon glyphicon-trash alert-danger pull-right" ></span>
</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
its executing threadabortexception .
I used same link as explained in the portal but as per my requirement i used in master page inside contentplaceholder i binded grid.