Anurag Singh
Anurag Singh

Reputation: 11

Fileupload not working with updatepanel in asp.net

<asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <asp:Panel ID="pnlFirstRegistration" runat="server" DefaultButton="btnNext">
                    <asp:TextBox ID="txtFirstName" runat="server" class="txtbox"></asp:TextBox>
                    <asp:Button ID="btnNext" runat="server" Text="NEXT" OnClick="btnNext_Click" />
                </asp:Panel>
                <asp:Panel ID="pnlFinalRegistration" runat="server" DefaultButton="btnSubmit" Visible="false">
                    <asp:FileUpload ID="fileUploader" AllowMutliple="true" runat="server"
                        accept=".png,.jpg,.jpeg,.gif" />
                    </div>
                    <asp:Button ID="btnSubmit" runat="server" Text="SUBMIT" OnClick="btnSubmit_Click" />
                </asp:Panel>
            </ContentTemplate>
            <Triggers>
                <asp:PostBackTrigger ControlID="btnSubmit" />
            </Triggers>
        </asp:UpdatePanel>

I have a update panel where first is a Next button and then Submit. When clicking Submit it is showing fileload HasRows property false. Whats the reason

It should show some files in upload control

Upvotes: 0

Views: 193

Answers (1)

Anurag Singh
Anurag Singh

Reputation: 11

I got the answer

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

This is working when there is multipart form

Upvotes: 1

Related Questions