更新面板内的 FileUpload 控件而不刷新整个页面? [英] FileUpload control inside an UpdatePanel without refreshing the whole page?

查看:37
本文介绍了更新面板内的 FileUpload 控件而不刷新整个页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 Microsoft,FileUpload 控件与 AJAX 不兼容更新面板.

According to Microsoft the FileUpload control is not compatible with an AJAX UpdatePanel.

我知道可以像这样将 PostBackTrigger 添加到表单的提交按钮:

I am aware that a PostBackTrigger can be added to the submit button of the form like this:

<Triggers>
  <asp:PostBackTrigger ControlID="Button1" />
</Triggers>

问题在于,这会强制表单执行完整的回发,这首先使使用 UpdatePanel 的全部意义无效.是否有解决此问题的方法不会导致整个页面刷新?

The problem is that this forces the form to perform a full post-back which voids out the whole point of using the UpdatePanel in the first place. Is there a workaround to this issue that does not cause the whole page to refresh?

推荐答案

我知道有第三方组件可以做到这一点.它被称为 "swfupload" 并且可以免费使用和开源,并且使用 javascript 和 flash施展魔法.

I know of a third party component that can do that. It's called "swfupload" and is free to use and open source, and uses javascript and flash to do the magic.

这是他们提供的功能列表:(来自他们的网站)

here is a list of the features they offer: (from their site)

  • 在对话框中通过 ctrl/shift-selecting 一次上传多个文件
  • 所有事件的 Javascript 回调
  • 在上传开始前获取文件信息
  • 使用 XHTML 和 css 样式上传元素
  • 使用 HTML 上传文件时显示信息
  • 无需重新加载页面
  • 适用于所有支持 Flash 的平台/浏览器.
  • 如果 Flash 或 javascript 是正常的,则优雅地降级为正常的 HTML 上传表单不可用
  • 上传开始前控制文件大小
  • 只在对话框中显示选择的文件类型
  • 在开始上传之前排队上传、删除/添加文件

他们还有一个演示区,您可以在其中玩弄他们的控制.这样您就可以确保它正是您想要的.

They also have a demo area where you can play around with their control. That way you can make sure it is exactly what you want.

我们在我们的一个项目中使用了它,到目前为止它从未让我们失望过,所以我认为这是一个安全的选择.

We used it in one of our projects and it has never failed us so far, so I think this is a safe bet.

哦,这里是下载页面:http://code.google.com/p/swfupload/

这篇关于更新面板内的 FileUpload 控件而不刷新整个页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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