Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7835879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T13:51:13+00:00 2026-06-02T13:51:13+00:00

Ihave a problam with a fileupload control i have an accordion and inside the

  • 0

Ihave a problam with a fileupload control
i have an accordion and inside the ContentTemplate i have a fileupload control and when the send button is been submited i am trying to find the control but getting it null al the time.

<asp:Accordion ID="Accordion1" runat="server" AutoSize="None" FramesPerSecond="40"
                SelectedIndex="-1" TransitionDuration="100" FadeTransitions="true" RequireOpenedPane="false"
                SuppressHeaderPostbacks="true" ContentCssClass="accordionContent" HeaderCssClass="accordionHeader"
                HeaderSelectedCssClass="accordionHeaderSelected" 
                OnItemCommand="Accordion1_ItemCommand" 
                onitemdatabound="Accordion1_ItemDataBound">
                <HeaderTemplate>
                    <%#DataBinder.Eval(Container.DataItem, "order_id")%>
                    <asp:Label ID="lblOrderID" runat="server" Text='<%#Eval("description")%>'></asp:Label>
                </HeaderTemplate>
                <ContentTemplate>
                    <asp:Label ID="lblNotes" runat="server" Text='<%#Eval("notes")%>'></asp:Label>
                    <asp:Label ID="lbltext" runat="server" Text='להגשת מועמדות למשרה זו צרף קו"ח'></asp:Label>
                    <asp:FileUpload ID="FileUpload1" runat="server" />
                    <asp:Button ID="btnSend" runat="server" Text="שלח" CommandName="send" />
                </ContentTemplate>
            </asp:Accordion>

 protected void Accordion1_ItemCommand(object sender, CommandEventArgs e)

    {
        if (e.CommandName == "send")
        {
            FileUpload fu = new FileUpload();
            fu = (FileUpload) FindControl("FileUpload1");
            if (fu.HasFile)
            {
                SmtpClient client = new SmtpClient();
                MailAddress from = new MailAddress("", "יש לך הודעה חדשה", System.Text.Encoding.UTF8);
                MailAddress to = new MailAddress("");
                MailMessage message = new MailMessage(from, to);
                message.Body = "";
                //Attachment data = new Attachment(FileUpload.
                //message.Attachments.Add(FindControl("fu"));
            }
        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T13:51:19+00:00Added an answer on June 2, 2026 at 1:51 pm

    By doing FindControl you are searching at the top-level container and FindControl is not recursive. If you want to find the upload control you need to search from the immediate parent, which seems to be Accordion1.

    FileUpload fu = Accordion1.FindControl("FileUpload1") as FileUpload;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with my code. My code is using the fileupload control
I have a FileUpload control, and when I select the file 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.txt' , (which
Possible Duplicate: How to restrict file type in FileUpload control I have a problem,
I have a Wizard control with one of the pages containing a FileUpload control.
I have an asyncfileupload control inside an update panel. The file succesfully upload and
I´m trying to re-enable the control button in a rich:uploadFile after upload the file.
I have problem SIMILAR to preventing form data reposting, but not quite the same
I have been playing around with asp.net webforms controls to learn how to use
I know that such question was has been many times already but I couldn't
I saw this question, Show Open Dialog on a Button click : 'I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.