FileUpload控件一个UpdatePanel内没有刷新整个页面? [英] FileUpload control inside an UpdatePanel without refreshing the whole page?

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

问题描述

根据微软的FileUpload控件是不符合一个AJAX的UpdatePanel兼容。

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 /移选择对话框上传多个文件一次
  •   
  • 在所有事件的Javascript回调
  •   
  • 在获取文件信息上传开始前
  •   
  • 在风格上传元素XHTML和CSS
  •   
  • 显示信息,而文件是使用HTML上传
  •   
  • 在没有页面重新加载必要
  •   
  • 工作在所有平台/浏览器具有闪存的支持。
  •   
  • 优雅地降低到正常的HTML上传表单如果Flash或JavaScript   不可用
  •   
  • 在上传开始前控制文件大小
  •   
  • 只显示选择文件类型对话框
  •   
  • 在队列上传,删除/上传开始前,添加文件
  •   
  • Upload multiple files at once by ctrl/shift-selecting in dialog
  • Javascript callbacks on all events
  • Get file information before upload starts
  • Style upload elements with XHTML and css
  • Display information while files are uploading using HTML
  • No page reloads necessary
  • Works on all platforms/browsers that has Flash support.
  • Degrades gracefully to normal HTML upload form if Flash or javascript is unavailable
  • Control filesize before upload starts
  • Only display chosen filetypes in dialog
  • Queue uploads, remove/add files before starting upload

他们也有一个试玩区在那里你可以玩弄自己的控制权。这样,你可以确保它正是你想要的。

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://$c$c.google .COM / P / SWFUpload的/

oh and here is the download page: http://code.google.com/p/swfupload/

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

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