Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AjaxFileUpload postback false

i am using AjaxFileUpload in ASP.NET 4.0 website. The problem is that when i upload a file its UploadComplete fires which causes a postback to page. on every postback caused by AjaxFileUpload the Ispostback property is False which should be True. What is the reason. I checked it in the updatePanel and without it. It has no affect at it. Here is the

  <ajax:AjaxFileUpload ID="AjaxFileUpload1" ContextKeys="fred" 
     AllowedFileTypes="jpg,jpeg,png,gif" MaximumNumberOfFiles="3" runat="server" 
        OnUploadComplete="AjaxFileUpload1_UploadComplete" />
like image 279
syed mohsin Avatar asked Feb 02 '13 19:02

syed mohsin


1 Answers

To detect postback from the AjaxFileUpload use this control's property: AjaxFileUpload.IsInFileUploadPostBack. The IsPostBack property doesn't works because this control submits not to the same page where is was rendered but to hidden frame instead so it's the first time for frame it loading on server. See more in AjaxControlToolkit sources: AjaxControlToolkit AjaxFileUpload

like image 190
Yuriy Rozhovetskiy Avatar answered Oct 07 '22 07:10

Yuriy Rozhovetskiy