Gautam Buddha Temple Varanasi,Varanasi - Buddhist Pilgrimage

Sunday, August 11, 2013

Losing file in a file upload control in update panel c# asp.net/File Upload Control is not working in Update Panel


 Solution : By Using Trigger option we need to Trigger the upload button from AsyncPostBackTrigger to PostBackTrigger.  
 So that after Postback when user clicked a button to upload file control will available.  
 <asp:ScriptManager ID="ScriptManager1" runat="server" />  
 <asp:UpdatePanel ID="UpdatePanel1" runat="server">  
   <ContentTemplate>  
     <asp:FileUpload ID="File1" runat="server" />  
     <asp:Button ID="btn1Upload" runat="server"  
       Text="Async_Upload" OnClick = "Upload_File" />  
     <asp:Button ID="btnUpload" runat="server" Text="Upload"  
       OnClick = "Upload_File" />          
   </ContentTemplate>  
   <Triggers>  
     <asp:AsyncPostBackTrigger ControlID = "btn1Upload"  
      EventName = "Click" />  
     <asp:PostBackTrigger ControlID = "btnUpload" />  
   </Triggers>  
 </asp:UpdatePanel>  

No comments:

Post a Comment