FileUpload 的 Hasfile 属性在 GridView 中始终为 false

发布于 2024-08-11 00:44:59 字数 328 浏览 1 评论 0原文

我在 GridView 中使用 FileUpload,这个 GridView 位于 UPdatePanel 中。此 FileUpload 位于 GridView 的页脚中。我正在同一 GridView 中的链接按钮上上传此 FileUploader 中选定的文件。但是上传时 HasFile 属性为 false。

我有谷歌解决这个问题,唯一的解决方案是将按钮放入

<asp:PostBackTrigger ControlID="Button1" />

但我的 FileUPloader 在 GridView 中。

任何帮助,谢谢。

I am using FileUpload in GridView and this GridView is in UPdatePanel. This FileUpload is in footer of the GridView. I am uploading selected file in this FileUploader on a link button in same GridView. BUT when on uploading HasFile property is false.

I have google for this problem and only solution is to put button in

<asp:PostBackTrigger ControlID="Button1" />

But my FileUPloader is in GridView.

Any help, Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

丑丑阿 2024-08-18 00:44:59

您可以选择使用 Ajax Upload jQuery 插件作为解决方法。该页面上的示例描述了如何在 asp.net 中访问上传的文件。搜索“IHttpHandler”

One option available to you as a workaround is to use the Ajax Upload jQuery plugin. An example on that page describes how to access the uploaded file in asp.net. Search for "IHttpHandler"

淡淡的优雅 2024-08-18 00:44:59

FileUpload 控件依赖于普通的 html 元素,并且在您提交 html 表单元素之前不会执行任何操作...这意味着您需要一个完整的回发而不是ajax更新来查看文件。

The FileUpload control relies on a normal <input type="file" /> html element, and that doesn't do anything until you submit the html form element... meaning you need a full postback rather than ajax update to see the file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文