posted 1/12/2009 by Vijendra Shakya
File upload control is not working when this control is inside the update panel.When we place the file upload control control inside the updatepanel and upload the file then FileUpload1.Hasfile is always false because file upload control is inside updatepanel then your file upload control does not post back. Because the file upload control works only when the full page postback. If you want to upload the file then you need to postback the page.So we need to create the PostBackTrigger for the button.
We place <trigger> between <UpdatePanel> and <ContentTemplate>
<asp:UpdatePanel runat="server" id="UpdatePanel1"> <ContentTemplate> <asp:FileUpload runat="server" id="FileUpload1" /> <asp:Button runat="server" id="btnSubmit" Text="Upload" /> </ContentTemplate> <Triggers> <asp:postbacktrigger ControlID="btnSubmit" /> </Triggers> </asp:UpdatePanel>
Triggers allow us to force a post back.
What kind of email newsletter would you prefer to receive from CodeAsp.Net?18