Solved

asp.net ajax

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

<asp:UpdatePanel runat="server" ID="updatePanel"> 
    <Triggers> </Triggers>
 <ContentTemplate>
 <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"/>      
 </asp:WizardStep>
 </asp:Wizard>
</ContentTemplate>
</asp:UpdatePanel>

Open in new window

0
Comment
Question by:CoolDev2014
  • 4
  • 3
7 Comments
 
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.

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

Here is a full code example:
http://www.codeproject.com/Articles/482800/FileplusUploadplusinplusUpdateplusPanel
0
 

Author Comment

by:CoolDev2014
ID: 39884750
btnUpload? I don't have that button in my codes.
0
 
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.
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

Author Comment

by:CoolDev2014
ID: 39890093
so there is no solution by using :AjaxFileUpload without a button?
0
 
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.
0
 

Author Comment

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

Accepted Solution

by:
Jerry Miller earned 500 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.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Add a Condition in ASP Repeater 6 34
ASP.NET Content Page 3 31
asp.net open new page without popup blocker 8 19
Can Angular be used with classic asp.net? 3 19
Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

830 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