Reputation: 187
I have a fileupload control on my .aspx page.
<asp:FileUpload ID="FileUpload1" runat="server" />
I am validating my control on my CS page.
if (FileUpload1.HasFile)
but this if condition is returning always false. I am not getting what is the actual reason! Can anyone help me in this?
Upvotes: 1
Views: 9893
Reputation: 187
I have put my FileUpload Control into a Updatepanel. Then apply a trigger on those buttons from where data is submitting.
<td>
<asp:UpdatePanel runat="server" ID="updatepanel1">
<Triggers><asp:PostBackTrigger ControlID="btnsubNxtClm" /></Triggers>
<Triggers><asp:PostBackTrigger ControlID="btnsubmit" /></Triggers>
<ContentTemplate>
<asp:FileUpload ID="FileUpload1" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
</td>
Upvotes: 0
Reputation: 3410
FileUpload
control is not compatible with UpdatePanel
. You have two options
UpdatePanel
PostBackTrigger
on the UpdatePanel
An example
<Triggers>
<asp:PostBackTrigger ControlID="yourButtonIdThatSubmitsFile" />
</Triggers>
For more information, you can refer to http://forums.asp.net/t/1142794.aspx
Upvotes: 3