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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:31:25+00:00 2026-06-07T22:31:25+00:00

My question is a simple one to answer I hope. I am making a

  • 0

My question is a simple one to answer I hope.

I am making a simple form with a file upload control that was not used in an AJAX panel at first and for the life of me I cannot work out why my code, which remains unchanged, would not find the contents of the FileUpload control.

<asp:Panel ID="pnlUpload" runat="server" class="workerDetailsPanelLeft" Visible="true">

<h3 class="titleHighlightStyle">Probation Documents</h3><br />
<table cellspacing="0">
<tr>
<td class="standardLabel" valign="top">Current Documents</td>
<td colspan="2">
<asp:ListBox ID="lstDocs" runat="server" Width="200px"></asp:ListBox>
</td>
</tr>
<tr>
<td>
&nbsp;
</td>
<td>
<asp:ImageButton ID="btnSelect" runat="server" SkinID="selectprobationdoc"/>
</td>
<td class="standardLabel" style ="width:200px">Select documents</td>
</tr>
<tr>
<td>
&nbsp;
</td>
</tr>
<tr>
<td class="standardLabel">Upload Documents</td>
<td colspan="2">
<asp:FileUpload ID="uplDoc" runat="server" Height="22px" Width="200px"/> 
</td>
</tr>
<tr>
<td>
&nbsp;
</td>
<td>
<asp:Button ID="btnSave" runat="server" Text="Save" OnClick="btnSave_Click" CausesValidation="False" />
</td>
</tr>
<tr>
<td>
&nbsp;
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblUploadError" runat="server" Text="Probation document required" ForeColor="Red" Visible="false"></asp:Label> 
</td>
</tr>
</table>             
</asp:Panel>

Forgive the formatting I deleted the white space!!

Now when my markup is like this and I call .HasFile() on the FileUpload it returns a null value?

When I add the following

<asp:UpdatePanel ID="ContentPanel" UpdateMode="Conditional" runat="server" ChildrenAsTriggers="true">
<Triggers>
<asp:PostBackTrigger ControlID="btnSave" />
</Triggers>
<ContentTemplate>
  *Markup as above*

I can get the contents of the control. I understand that there was an issue with the Ajax update panel with file upload control and the solution is to add a postback trigger, but can anyone see from this markup why it may fail o find the file?

            if (this.uplDoc.HasFile)
        {
            String fileExtension = System.IO.Path.GetExtension(uplDoc.FileName).ToLower();
            String validExt = sAllowedExt;

            if (validExt.IndexOf("," + fileExtension + ",") != -1)
            {
                if (this.uplDoc.FileBytes.Length >= 0)
                {
                    return string.Empty;
                }
                else
                {
                    return "PROC0003";  //Invalid File Size            
                }
            }
            else
            {
                return "PROC0002"; //Invalid file type        
            }
        }

Above is the initial code behind check, this never changed from ading the update Panel.

Can someone help me understand what I missed?

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-06-07T22:31:28+00:00Added an answer on June 7, 2026 at 10:31 pm

    It was a simple one to answer,

    Master page that hosts the content pages wraps those pages in an update Panel, hence why my code was not getting the contents of the file upload control, it was doing an asynchronous postback and not a full postback.

    Thanks anyway @Shai

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

Sidebar

Related Questions

This is probably a basic html/css question... I have a simple one-button form that
A minor question that I hope admits of a simple answer that I'll kick
Simple question for the one who knows the answer... $xml = simplexml_load_file(http://url/path/file.xml); This url
Hopefully a simple question although one I have found impossible to answer myself using
This is quite a simple question - although one that is on my mind
Simple question. I'm new to Clojure. How can I use one file from my
Well simple question here (maybe not a simple answer?) Say I have a two
I'm new to CodeIgniter and I hope that my question will have a simple
The question is quite simple, and I hope the answer it's simple too :)
a simple question but Ive realised im not sure of the answer for this

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.