FileUpload.PostedFile里面总是空的UpdatePanel [英] FileUpload.PostedFile always null inside UpdatePanel

查看:412
本文介绍了FileUpload.PostedFile里面总是空的UpdatePanel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个UpdatePanel内的FileUpload控件。我已经成功注册了上传按钮使用ScriptManager做了充分的回发。我唯一​​的问题是,FileUpload.HasFile总是返回null。
注意:当我移动FileUpload控件在UpdatePanel一切工作的文件之外。是否有一个解决方案或替代方法。

I have a FileUpload control inside an UpdatePanel. I have successfully registered the upload button with the scriptmanager to do a full postback. The only issue I have is that FileUpload.HasFile is always returning null. Note: When I move the FileUpload control outside of the updatepanel everything works file. Is there a solution or workaround for this.

感谢。

推荐答案

您可以把一个UpdatePanel一个FileUpload控件,但你必须使用一个PostBackTrigger而不是一个AsyncPostBackTrigger。我最近使用这种方法并结合这两种类型的触发器。

You can put a FileUpload control in an UpdatePanel but you have to use a PostBackTrigger as opposed to an AsyncPostBackTrigger. I recently used this approach and combined both types of trigger.

    <Triggers>
        <asp:PostBackTrigger ControlID="btnSave" />
        <asp:AsyncPostBackTrigger ControlID="btnAsyncSave"/>
    </Triggers>

的PostBackTrigger用于文件上传而被用于所有其它表单字段AsyncPostBackTrigger

The PostBackTrigger was used for FileUploads while the AsyncPostBackTrigger was used for all the other form fields.

这篇关于FileUpload.PostedFile里面总是空的UpdatePanel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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