Showing posts with label UpdatePanel. Asp.net. Show all posts
Showing posts with label UpdatePanel. Asp.net. Show all posts

Tuesday, October 22, 2019

file upload not working in updatepanel asp.net


The Fileupload Control is not working in the UpdatePanel in asp.net. To use the FileUpload control in the Updatepanel. We need to add the Post back trigger to the UpdatePanel Like the below Code

<asp:UpdatePanel ID="UpnlFileUpload" runat="server">
    <ContentTemplate>
        <asp:FileUpload ID="FlUpload" runat="server" />
        <asp:Button ID="btnFileUpload" runat="server" Text="Upload" OnClick="btnFileUpload_OnClick" /> </ContentTemplate>
    <Triggers> <asp:PostBackTrigger ControlID="btnFileUpload" />
    </Triggers>
</asp:UpdatePanel>
Here we need to pass the Button Control ID in the PostBackTrigger Like the above code.

Generally after adding the PostBackTrigger it works accurate but some time it will not work. In this case you need to add the below code in the Page_Load .

Page.Form.Attributes.Add("enctype", "multipart/form-data");