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 3240570
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:06:02+00:00 2026-05-17T18:06:02+00:00

I’m trying to get the values of dynamically generated FileUpload controls that I add

  • 0

I’m trying to get the values of dynamically generated FileUpload controls that I add to a Panel:

<asp:Panel ID="pFileControls" runat="server">
</asp:Panel>

I create the controls during a loop through a record set:

foreach(DataRow dr in ds.Tables[0].Rows)
{
    FileUpload fu = new FileUpload();
    fu.ID = dr["SomeID"].ToString();

    pFileControls.Controls.Add(fu);
}

Everything works fine up to the point where I submit the form with this button:

<asp:Button ID="btnImportFile" runat="server" Text="Save" OnClick="btnImportFile_Click" />

Which I register like this (Page_Load):

ScriptManager.GetCurrent(this).RegisterPostBackControl(btnImportFile);

I do this because I’m using a MasterPage/ContentPage setting in my website and mostly everything happens inside an UpdatePanel for AJAXification purposes. Bear in mind that if I explicity specify a FileUpload Control in the HTML view, it works 100%.

When the form is submitted I try to iterate the Panel like this:

foreach (Control ctrl in pFileControls.Controls)
{
    if (ctrl.GetType() != typeof(FileUpload))
    {
        continue;
    }

    //Do the saving of the file here
}

Except, the Panel seems to only return one control: The Content Place Holder for the page and nothing else. Does anyone have some ideas about this?

  • 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-05-17T18:06:02+00:00Added an answer on May 17, 2026 at 6:06 pm

    What part of the life cycle are you adding the dynamic controls?

    if you are putting them in the page_load it may be too late, try putting the generation of the dynamic controls into the page_init and see if that fixes the problem.

    page lifecycle
    http://msdn.microsoft.com/en-us/library/ms178472.aspx

    dynamic controls
    http://geekswithblogs.net/shahed/archive/2008/06/26/123391.aspx
    Note:

    “Its recommended to load the dynamic
    controls during the Page_Init instead,
    because we may want to hook up our
    events with proper handler at an early
    stage. … Do not assigning
    properties of a dynamic control
    (viewstate enabled), during Page_Init,
    it will not be reflected. “

    I would expect that even with the update panel, you will need to be mindful of the page_load limitations with dynamic controls.

    let me know if this helps or if I missed the mark!

    Let’s try a different course of action (I’ve gotten dynamic file upload to work, but it was a bear and I wish I had simply used this)
    http://www.asp.net/ajaxlibrary/act_AsyncFileUpload.ashx

    or
    http://en.fileuploadajax.subgurim.net/

    these may not create a ‘loop’ of elements, but you can simply keep loading docs on a as-needed basis.

    I have specifically used
    http://www.asp.net/ajaxlibrary/act_AsyncFileUpload.ashx
    to great effect.

    There also appear to be some limitations to the update:panel and the file upload, check out these sites.

    (this one says it does not work in partial update status but does work in full postback)
    http://forums.asp.net/p/1105208/1689084.aspx

    do you know if the submit is triggering the full page or just the update:panel? (check out this: http://geekswithblogs.net/mmintoff/archive/2009/04/01/fileupload-within-updatepanel.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I have just tried to save a simple *.rtf file with some websites and

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.