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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:29:32+00:00 2026-05-26T02:29:32+00:00

I have an asyncfileupload control inside an update panel. The file succesfully upload and

  • 0

I have an asyncfileupload control inside an update panel. The file succesfully upload and fires the correct server side code. The code on the server is exected as expected however, one line in the server code changes the text on a label. I step through the code in debug mode and the line is executed but no change is made to the page.

Here’s some of the code:

<asp:UpdatePanel runat="server" ID="updater" > 
    <ContentTemplate> 
        <asp:AsyncFileUpload ID="fileUpload" runat="server" OnUploadedComplete="FileUploadComplete" /> 
        <asp:Label ID="AsyncText" runat="server" Text="File Type not checked" />  
    </ContentTemplate> 
</asp:UpdatePanel> 
public void FileUploadComplete(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e) 
{ 
    System.Threading.Thread.Sleep(500); 
    if(fileUpload.HasFile) { AsyncText.Text = "file of correct format: "; } 
}

Can anyone help me with solving this problem or offering annother solution??

Thanks

  • 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-26T02:29:33+00:00Added an answer on May 26, 2026 at 2:29 am

    I think you are going to have to move toward a different solution. From your label message, it looks like you are trying to check the file type, correct? Basically, the AsyncUplaod control, although posting back to get the uploaded file to the browser, is not actually updating the page’s viewstate, thus the label never gets updated. Boo! I was able to visualize this using this code in the page load event.

    if (Page.IsPostBack)
    {
        if (Request.Files.Count > 0)
        {
            AsyncText.Text = "file of correct format";
            ListItem item = new ListItem("item to add");
            lb.Items.Add(item);
        }
    }
    

    This was allowing me to set the label text but still nothing changed until I clicked on a random button that I added to the page. This button didnt even have an event in the code behind, but it was enough to cause a normal postback, and the label text and list item were successfully updated/added to the list. With that said, I would wait to update any labels until the user clicks upload by using a seperate upload button. (ie use the AsyFileUplaod to get it to the browser, but another button to save the file to the server). You can always do file evaluations in the button click event by referencing the posted files to the webpage as I did in the code above.

    Some other examples I found online were using javascript to change the label text which works well also. Somthing like this:

    string message = "";
    if (e.StatusMessage == "Success")
    {
       message = "File upload successful;";
    }
    else
    {
       message = "File did not upload successfully;";
    }
    ClientScript.RegisterStartupScript(this.GetType(), "akey", "document.getElementByID('label').value =" + message, true);
    

    Another example: here

    I think in this case it’s just the nature of the control and the only way to achieve what you want is though some creative thinking. If you have any other questions about anything I listed here feel free to ask.

    Good luck!

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

Sidebar

Related Questions

I have a ajax file upload inside my update panel to upload the file
I have a file upload page with an AsyncFileUpload control. When the user browses
I have used AsyncFileUpload AJAX control to upload a file to a column in
I have an asyncfileupload control that I'm using from the ajaxcontroltoolkit. On the file
I am using ajax toolkit asyncFileUpload control I had problem that my server side
I have a asp:FileUpload control in my page. The default file size is 4MB.
I'm using an AsyncFileUpload (AJAX Toolkit) to upload images. I have a Button which
I am having a strange issue associated with AsyncFileUpload control. after the upload, I
I have a user control with a updatepanel, script manager and a asyncfileupload control.
I have added AJAX Controls. Is it possible to upload multiple files using AsyncFileUpload

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.