asp.net ajax

Posted on 2014-02-24
Medium Priority
Last Modified: 2014-03-12
I have below codes and the ajaxfileUpload is not working. Why and how to fix?

<asp:UpdatePanel runat="server" ID="updatePanel"> 
    <Triggers> </Triggers>
 <asp:Wizard ID="Wizard1"  Width="1580px" runat="server" CssClass="box_a"  DisplaySideBar="False">
<asp:WizardStep ID="WizardStep1" runat="server" Title="Step 1">
 <asp:AjaxFileUpload ID="AjaxFileUpload1" runat="server" OnUploadComplete="FileUploadComplete" Width="1000px"/>      

Open in new window

Question by:CoolDev2014
  • 4
  • 3
LVL 18

Expert Comment

by:Jerry Miller
ID: 39883647
I've had to define triggers to make the ASP fileupload to work inside an updatepanel. It may be something similar with the Ajax version.

                <asp:PostBackTrigger ControlID="btnUpload"  />
                <asp:AsyncPostBackTrigger ControlID="btnProcessData" />

Here is a full code example:

Author Comment

ID: 39884750
btnUpload? I don't have that button in my codes.
LVL 18

Expert Comment

by:Jerry Miller
ID: 39885924
The UpdatePanel and FileUpload processes don't like to work together, so you have to make them work by using the triggers.

If you remove the UpdatePanel and your fileupload process works, you need to follow the example on the link that I supplied. It details how to define the Triggers section and set postbacks to work within the updatepanel.
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions


Author Comment

ID: 39890093
so there is no solution by using :AjaxFileUpload without a button?
LVL 18

Expert Comment

by:Jerry Miller
ID: 39890336
You can remove the UpdatePanel. You don't have anything in there that requires an asynchronous postback anyway.

Author Comment

ID: 39898801
My point is...I don't want to create another button for file upload because ajaxfileupload already have one.
LVL 18

Accepted Solution

Jerry Miller earned 2000 total points
ID: 39899029
If you leave it as is it doesn't work because the FileUpload control always thinks it is empty when placed inside an UpdatePanel.

If you remove the UpdatePanel, you can leave the FileUpload Control alone. Unless someone has found another way around this problem, your options are to remove the UpdatePanel or add triggers with extra buttons.

I have searched a lot on this subject and I normally use the triggers because I will have a label to display success or failure of the upload. But I do sometimes put the FileUpload outside of the UpdatePanel. It really depends on what is necessary in each situation.

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

There is a wide range of advantages associated with the use of ASP.NET. This is why this programming framework is used to create excellent enterprise-class websites, technologies, and web applications.
This article describes and provides a custom-made tool I wrote to give businesses a means of identifying commercial music content, without having to expend too much effort. Business recordings are easily identified from possibly illegal music files …
Free Data Recovery software is an advanced solution from Kernel Tools to recover data and files such as documents, emails, database, media and pictures, etc. It supports recovery from physical & logical drive after a hard disk crash, accidental/inte…
Watch the video to know how one can repair corrupt Exchange OST file effortlessly and convert OST emails to MS Outlook PST file format by using Kernel for OST to PST converter tool. It can convert OST to MSG, MBOX, EML to access them. It can migrate…

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question