Click here to Skip to main content
15,921,660 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
this is my part of code

XML
<Triggers>
              <asp:AsyncPostBackTrigger ControlID="btnsave" />
              <asp:PostBackTrigger ControlID="FileUpload1" />
          </Triggers>


please help me...
Posted
Updated 5-Sep-17 22:19pm

1 solution

That's not the way to attach a trigger for file upload.

Try this:
XML
<div>
    <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager>
        <asp:UpdatePanel ID="updPanel" runat="server" UpdateMode="Conditional">
        <Triggers>
            <asp:PostBackTrigger ControlID="btnUpload" />
        </Triggers>
            <ContentTemplate>
                <asp:FileUpload ID="fupload" runat="server" /><br />
                <asp:Button ID="btnUpload" runat="server" Text="Upload"  onclick="btnUpload_Click" />
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
 
Share this answer
 
v2
Comments
sathiserg 17-May-12 5:09am    
Thanks,but If i use that method means the whole page is reloaded. i don't want page reload.
Sandeep Mewara 23-May-12 2:53am    
You have to do full page reload for general file upload control - it works like that.

In case you need async upload and partial page update, look at the Ajaxtoolkit Async upload control.
snamyna 9-Aug-12 2:46am    
Hye Sandeep Mewara.. I have encountered same problem. I have tried as you suggest, no error occurs but it still didnt work for me.
I have a fileUpload1, btnUpload, and an imagebutton1 to indicate that after user successfully uploaded a file, the imagebutton will appear. But nothing occurs. :(
Sandeep Mewara 9-Aug-12 10:10am    
Not clear on what you are trying to say. Can you please open a new question with details.
robert.taylor.twu 22-Feb-15 15:09pm    
Sandeep you are the only person who actually posted a way that works for handling the postback triggers on a fileupload control in update panels.. I have tried every method under the sun but yours is the first to work and I think it's because you specify putting the post back trigger right after the updatepanel declaration and right before the content template. Outstanding and many thanks!

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900