Last post Feb 16, 2012 04:44 AM by dtromp
May 28, 2011 08:25 AM|dtromp|LINK
I have a page that is using the AsyncFileUpload AJAX control to upload a file. This all works fine but whenever another control forces a full page post back, the AsyncFileUpload control loses its value. (The file name that was selected) Viewstate is enabled
and I am not using an update panel.
Any idea what could cause this?
May 28, 2011 10:37 AM|prabinyovan|LINK
Refer this thread http://forums.asp.net/p/1528696/3697135.aspx
May 28, 2011 10:38 AM|Tamilmani Kpr|LINK
Are you using telerik AsyncFileUpload control?
May 28, 2011 07:44 PM|dtromp|LINK
First of all thanks for responding.
I tried to add history but that didn't seem to work either, I am probably doing something wrong. I stripped the code out again and tried it with a very basic page,
I am using the Toolkitscriptmanager on my MasterPage. Can you show me which code I need to add on server side to have the AsyncFileUpload control maintain its state?
<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolderMain" Runat="Server">
<asp:AsyncFileUpload ID="AsyncFileUpload1" runat="server" />
<asp:Button ID="Button1" runat="server" Text="Button" />
May 28, 2011 07:46 PM|dtromp|LINK
No I am using the AsyncFileUpload from the Ajax toolkit
May 30, 2011 04:54 AM|chetan.sarode|LINK
Hi, Please refer this
May 31, 2011 05:41 AM|dtromp|LINK
That is just basic documentation about the control which does not mention anything about maintaining the state of the control of managing the history of it.
May 31, 2011 11:50 AM|joejake|LINK
Please read about the page life cycle this is very helpfull to understand on how your page works. And for you to know where to put your code to avoid the post back problem. Please read more on this link
Hope can help you.
Jun 01, 2011 03:18 AM|dtromp|LINK
Although that is a great article, it does not solve my problem.
I am up to speed on control state and viewstate, my problem is that AsyncFileUpload does not maintain state at all.
Nov 14, 2011 03:03 AM|joejake|LINK
Yes, that is one you need to understand the right place of your code. The solution on your problem is put your AsyncFileUpload outside of your updatepanel. Sorry for a delayed reply on your comment. I just busy for a couple of months.
Hope this idea can help you.
Nov 15, 2011 04:19 AM|dtromp|LINK
Hi, even when I don't use an updatepanel at all, the AsyncFileUpload still not maintains state. Try the simple piece of code on my second post and you will see what I mean. As soon as you click the submit button (with postback without AJAX) the state of
the AsyncFileUpload control is lost.
Nov 16, 2011 03:29 AM|chetan.sarode|LINK
The problem is that the file has been uploaded to the server on postback. Even if the file name/path has been stored somewhere, it still can't be uploaded automatically for security. The file can't be uploaded without a user's interacion.
Nov 22, 2011 11:36 AM|joejake|LINK
Please see the link below it will explain why and how to solve your problem.
Hope the link that I shared can help you.
Feb 07, 2012 04:23 AM|dtromp|LINK
Hi, I looked at that article but that one is using the standard upload control whereas I am using the AsyncFileUpload control form the AJAX toolkit. Storing the state to the session does not work either. The article uses a label to show the filename, I can
do that, that is not the problem but what I want is the filename inside of the AsyncFileUpload control to be maintained but this property is read only so I cannot repopulate it from a session.
Feb 07, 2012 04:24 AM|dtromp|LINK
Hi, I enabled history for the page and history itself works but the only control that does not maintain state, even with history turned on and working is the AsyncFileUpload control. In other words, it still does not maintain the filename. In one of my previous
posts I shows a simple piece of code that you can use to recreate the problem.
Feb 07, 2012 04:55 AM|dtromp|LINK
Appearantly I am not the only one who noticed this behavior. Check out http://ajaxcontroltoolkit.codeplex.com/workitem/26729
Feb 15, 2012 12:09 PM|joejake|LINK
Please try the following solutions on the link below:
Hope the link can help you.
Feb 16, 2012 04:44 AM|dtromp|LINK
Although I appreciate your time and effort, none of your posts actually addresses my issue. I have a very good understanding of how the aSyncFileUpload control works but it seems like I have simply hit a bug: http://ajaxcontroltoolkit.codeplex.com/workitem/26729 Unless
someone has a workaround, I will just have to wait until it gets addressed.