FileUpload 的 Hasfile 属性在 GridView 中始终为 false
我在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以选择使用 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"
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.