在autopostback中从fileupload中选择Item Vanish。 [英] While in autopostback selected Item Vanish from fileupload.

查看:82
本文介绍了在autopostback中从fileupload中选择Item Vanish。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

protected void Page_Load(object sender, EventArgs e)
   {
       if (this.Session["FileUpload1"] == null && FileUpload1.HasFile)
       {
           this.Session["FileUpload1"] = FileUpload1;
       }
       else if (this.Session["FileUpload1"] != null && FileUpload1.HasFile)
       {
           FileUpload1 = (FileUpload)this.Session["FileUpload1"];
       }


       else  if (!IsPostBack)
       {



           Session["CheckRefresh"] = Server.UrlDecode(System.DateTime.Now.ToString());
           if (this.Session["FileUpload1"] == null && FileUpload1.HasFile)
           {
               this.Session["FileUpload1"] = FileUpload1;
           }
           else if (this.Session["FileUpload1"] != null && FileUpload1.HasFile)
           {
               FileUpload1 = (FileUpload)this.Session["FileUpload1"];
           }
           else if (FileUpload1.HasFile)
           {
               this.Session["FileUpload1"] = FileUpload1;
           }
           Bindstate();
           Bindclass();
       }
       else if (FileUpload1.HasFile)
       {
           this.Session["FileUpload1"] = FileUpload1;
       }
       else
       {
       }


   }

推荐答案

将所有控件放在Asp.net更新面板中。另外,为了将文件发布到服务器,请在提交按钮上使用回发触发器。
Place all your controls within Asp.net Update Panel. Also, in order to post the file to the server use Postback "trigger" on submit button.


当页面回发时,fileupload控件将从控件中删除文件,所以你必须更改客户端的下拉列表
when page was post back at that time fileupload control will remove the file from the control so you have to change the dropdown at client side


这篇关于在autopostback中从fileupload中选择Item Vanish。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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