0

<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

  • why you are using HasRows to check fileupload have any files or not. you can check it by fileUploader.HasFile – Kevin Shah Jun 07 '19 at 09:15
  • Possible duplicate of [FileUpload Doesn't Work When Nested In UpdatePanel? C#](https://stackoverflow.com/questions/2107952/fileupload-doesnt-work-when-nested-in-updatepanel-c-sharp) – dpant Jun 07 '19 at 10:30
  • I mean same fileUploader.HasFile is giving false result even if I am selecting files. – Anurag Singh Jun 07 '19 at 10:51

1 Answers1

1

I got the answer

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

This is working when there is multipart form