Click here to Skip to main content
11,704,509 members (55,314 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: ASP.NET
I have a repeater control which is inside Update Pannel this update pannel contains Asynchronous postBack triggers.this repeater shows the files from certain folder.i have item commends for download and delete the update pannel control i called the asynchronous trigger for delete files because i wanted to update repeated withot postback its working fine.but when i tried to download the file its not working the fallowing is the code its working for when i place a button and call the same method

public void DownloadFile(string filePath)
            if (File.Exists(HttpContext.Current.Server.MapPath(filePath)))
              string fileName = Path.GetFileName(filePath);
                    Response.ContentType = "application/octet-stream";
                    Response.AddHeader("Content-Disposition", "attachment; filename="+fileName);


The above code is working from the button which is outside the repeater but it is not working for the linkbutton which is in repeater
Posted 22-May-13 21:21pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Yes. It will not work inside updatepanel. You will have to add a postback trigger inside updatepanel. specify your repeater's ID controlID. For example something like this:

<asp:updatepanel id="YourUpdatePanel" runat="server">
<triggers><asp:postbacktrigger controlid="YourRepeaterControlID" /></triggers>
Your Repeater Control etc...
krishna_goluguri at 23-May-13 3:37am
I used the same like above but instead of <asp:postbacktrigger i used asp:AsyncPostBackTrigger
my code is like below
<asp:UpdatePanel runat="server" ID="upFiles" UpdateMode="Conditional">

Repeater control

<asp:AsyncPostBackTrigger ControlID="rptUploadedFiles" />
<asp:AsyncPostBackTrigger ControlID="btnRefreshFileList" />

Zafar Sultan at 23-May-13 5:43am
Replace <asp:AsyncPostBackTrigger ControlID="rptUploadedFiles" /> with
<asp:PostBackTrigger ControlID="rptUploadedFiles" />

It's the only way you can make it work.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 700
1 OriginalGriff 495
2 Andy Lanng 275
3 CPallini 242
4 Maciej Los 235
0 OriginalGriff 8,824
1 Sergey Alexandrovich Kryukov 8,247
2 CPallini 5,189
3 Maciej Los 4,726
4 Mika Wendelius 3,606

Advertise | Privacy | Mobile
Web03 | 2.8.150819.1 | Last Updated 23 May 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100