问题使用ASP。在UpdatePanel中使用NET FileUpload控件?

时间:2023-02-02 03:38:48

I'm running into an issue where I have a FileUpload control in an UpdatePanel. When I attempt to save changes and upload the file, no file is found. If I remove the UpdatePanel everything seems to work fine.

我遇到了一个问题,在UpdatePanel中有一个FileUpload控件。当我尝试保存更改并上传文件时,没有找到文件。如果我删除UpdatePanel,一切看起来都很好。

Any ideas why this might be happening? And is there a work-around?

你知道为什么会这样吗?有什么变通的办法吗?

问题使用ASP。在UpdatePanel中使用NET FileUpload控件?

1 个解决方案

#1


10  

To upload a file you need to perform a full ASP.NET page postback, it does not operate over the partial postback method.

要上传文件,需要执行完整的ASP。NET页面回发,它不会对部分回发方法进行操作。

You'll need to register the button which "uploads" your file as a PostBackTrigger of the UpdatePanel's triggers.

您需要将“上传”文件的按钮注册为UpdatePanel触发器的PostBackTrigger。

There are lots of free (and non-free) AJAX file upload solutions, or you can easily create one, it's just a matter of putting your file upload control within an iframe and submitting the iframe page back to the server. It isn't really ajax, but it gives a visual impression of AJAX.

有很多免费的(和非免费的)AJAX文件上传解决方案,或者您可以轻松创建一个,只需将文件上传控件放在iframe中并将iframe页面提交回服务器即可。它不是真正的ajax,但它给人一种ajax的视觉印象。

#1


10  

To upload a file you need to perform a full ASP.NET page postback, it does not operate over the partial postback method.

要上传文件,需要执行完整的ASP。NET页面回发,它不会对部分回发方法进行操作。

You'll need to register the button which "uploads" your file as a PostBackTrigger of the UpdatePanel's triggers.

您需要将“上传”文件的按钮注册为UpdatePanel触发器的PostBackTrigger。

There are lots of free (and non-free) AJAX file upload solutions, or you can easily create one, it's just a matter of putting your file upload control within an iframe and submitting the iframe page back to the server. It isn't really ajax, but it gives a visual impression of AJAX.

有很多免费的(和非免费的)AJAX文件上传解决方案,或者您可以轻松创建一个,只需将文件上传控件放在iframe中并将iframe页面提交回服务器即可。它不是真正的ajax,但它给人一种ajax的视觉印象。