FileUpload.HasFile始终显示为false。 [英] FileUpload.HasFile is always showing false.

查看:114
本文介绍了FileUpload.HasFile始终显示为false。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在updatepanel内的updatepanel和fileupload控件外面有按钮。当我尝试上传文件时,FileUpload.HasFile始终为false。



先谢谢。

解决方案

请在Page_load中使用此代码:



  if (!IsPostBack)
{}





您是否将触发器置于<   update     panel  > 例如

< asp:UpdatePanel < span class =code-attribute> ID = UpdatePanel1 runat = server > ;
< 触发器 >
< asp:PostBackTrigger ControlID = btnUploadFile / >
< /触发器 >
< rest 代码 >
< / asp:UpdatePanel >





此外,你可以从UpdatePanel中取出FileUpload控件,问题是解决了。


I Have button outside updatepanel and fileupload control inside updatepanel. When i try to upload a file FileUpload.HasFile is always false.

Thanks in Advance.

解决方案

please use this code in the Page_load :

if(!IsPostBack)
{}



Did you placed the trigger inside <update panel> like

<asp:UpdatePanel ID="UpdatePanel1"  runat="server">
  <Triggers>
    <asp:PostBackTrigger ControlID="btnUploadFile" />
  </Triggers>
 <rest of the code>
</asp:UpdatePanel>



Also You can pulled out the FileUpload control from UpdatePanel, the problem is solved.


这篇关于FileUpload.HasFile始终显示为false。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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