Click here to Skip to main content
15,868,123 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All,

I have one file upload control and two buttons on my page. I have put those button under updatepanel and added triggers as well. My problem is if i click on upload button after uploading file, im not getting that file and getting fileupload.hasfile as null.

Below is my code


C#
<tr>
<td>
<asp:Label Text="Upload:" runat="server" ID="lblUpload"></asp:Label>
</td>
<td style="padding-removed 15px">
<asp:FileUpload ID="fileUploadUsers" runat="server" ToolTip="Upload Excel" size="40" />
</td>
</tr>
 <tr>
<td colspan="2" align="center" style="padding-removed 250px; padding-removed 10px">
<asp:UpdatePanel ID="updatePanel" runat="server">
<ContentTemplate>
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<asp:Button ID="btnLoad" ValidationGroup="test" runat="server" CssClass="btn75px" Text="Load" OnClick="btnLoad_Click" />
</td>
<td style="padding-removed 15px">
 <asp:Button ID="btnClear" runat="server" CssClass="btn75px" Text="Clear" OnClick="btnClear_Click" />
</td>
</tr>
 </table>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnLoad" EventName="click" />
<asp:AsyncPostBackTrigger ControlID="btnClear" EventName="click" />
</Triggers>
</asp:UpdatePanel>
 </td>
 </tr>


Can any one help me on this...

Thanks in advance...

Regards,
Naveen kumar
Posted
Updated 26-Jul-13 19:13pm
v3
Comments
vinay.tatipamula 26-Jul-13 13:32pm    
You should keep the btnLoad button out of UpdatePanel,a Partial postback does not support Uploading a file .
NaVeN Kumar 27-Jul-13 1:13am    
okay... I need to show loading image when they click on Load button. Iam doing that using update progress... If I remove load button from updatepanel is it possible to show Loading image?.

1 solution

You should use PostBackTrigger instead as a AsyncPostBackTrigger and it should work fine.
See a similar solution here[^].

--Amit
 
Share this answer
 
Comments
NaVeN Kumar 27-Jul-13 2:47am    
Thanks Amy for the solution. But in this case update progress is not working... Is there any way to show loading image while uploading file...?
_Amy 27-Jul-13 3:26am    

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