Basit Khan

Basit Khan

  • NA
  • 336
  • 120.7k

Datalist inside update panel linkbutton is not downloading f

Jul 31 2017 6:52 AM
Hi,
DataList Inside update panel linkbutton is not downloading file.
Below is my code
  1. <asp:UpdatePanel ID="UpdatePanel1" runat="server">   
  2. <ContentTemplate>   
  3. <asp:Panel runat="server" ID="UpdatePanel1" ChildrenAsTriggers="false">   
  4. <div style="vertical-align: middle; min-height: 480px;" class="pre-scrollable">   
  5. <div>   
  6. <asp:DataList ID="DataList2" runat="server" p Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Center" RepeatLayout="Table">   
  7. <ItemTemplate>   
  8. <div>   
  9. <asp:Label ID="Label2" runat="server" Text='<%# Eval("FileName") %>'></asp:Label>   
  10. <asp:LinkButton ID="LinkButton1" runat="server" Text='<%# Eval("ImagePath") %>' OnClick="DownloadFile" CommandArgument='<%# Eval("Id")%>'></asp:LinkButton>   
  11. </div>   
  12. </ItemTemplate>   
  13. </asp:DataList>   
  14. </div>   
  15. </div>   
  16. </asp:Panel>   
  17. </ContentTemplate>   
  18. </asp:UpdatePanel>  
  19. Dim fileName as String="D:\Image\1.jpg" Response.Clear() Response.Buffer = True Response.Charset = "" Response.Cache.SetCacheability(HttpCacheability.NoCache) 'Response.ContentType = contentType Response.AppendHeader("Content-Disposition", Convert.ToString("attachment; filename=") & fileName) 'Response.BinaryWrite(bytes) Response.Flush() Response.[End]()  
I try the following code but also no success
</ContentTemplate> <Triggers> <asp:PostBackTrigger ControlID="LinkButton1" /> </Triggers>

Answers (2)