AjaxFileUpload假回传 [英] AjaxFileUpload postback false

查看:237
本文介绍了AjaxFileUpload假回传的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 AjaxFileUpload ASP.NET 4.0 网​​站。问题是,当我上传文件的 UploadComplete 火灾导致回发到页面。每回发 AjaxFileUpload 引起的IsPostBack 属性是这应该是。是什么原因。我在的UpdatePanel 没有它检查它。它没有它的影响。这里是

 < AJAX:AjaxFileUpload ID =AjaxFileUpload1ContextKeys =弗雷德
     AllowedFileTypes =JPG,JPEG,PNG,GIFMaximumNumberOfFiles =3=服务器
        OnUploadComplete =AjaxFileUpload1_UploadComplete/>


解决方案

要在AjaxFileUpload检测回发使用该控件的属性: AjaxFileUpload.IsInFileUploadPostBack 。在的IsPostBack 属性不会有效,因为这种控制没有提交到已被呈现在同一页面,而是隐框代替它的第一次帧它装在服务器上。查看更多在AjaxControlToolkit来源:<一个href=\"http://ajaxcontroltoolkit.$c$cplex.com/SourceControl/changeset/view/a2a6dc6854e0#SampleWebSites/AjaxControlToolkitSampleSite/AjaxFileUpload/AjaxFileUpload.aspx.cs\">AjaxControlToolkit AjaxFileUpload

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" />

解决方案

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

这篇关于AjaxFileUpload假回传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆