选择下拉列表时FileUploadControl值丢失 [英] FileUploadControl value lost on dropdown selection

查看:80
本文介绍了选择下拉列表时FileUploadControl值丢失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我有一个FileUpload控件和下拉菜单.选择下拉时,在FileUpload控件文件名因回传丢失.
回发后如何保留FileUpload控件的值.请尽快提供帮助

谢谢

解决方案

AFAIK,您不能在回发后恢复值.


将Dropdownlist放在更新面板中,它将起作用


我使用会话来解决此问题
在Page_load中,将Fileupload分配给会话

会话["abc"] = filUpld;

并在需要时将会话分配给fileupload.

例如:在提交"按钮中单击事件

 如果(会话["  abc"]!= "   abc"].ToString()!=  ")
        {
            filUpld =(FileUpload)Session [" ];
        }

然后 然后使用 filUpld 照常 

>


hi I have a FileUpload control and dropdown. when the drop down is selected, the file name in the FIleUpload control is lost due to postback.
How can I retain the value of FileUpload control after postback. please help ASAP

Thanks

解决方案

AFAIK, you cannot retiain the value after postback.


Place the Dropdownlist in update panel, it will work


I used session to solve this
in Page_load assign the Fileupload to session

Session["abc"]=filUpld;

and when you wish just assign the session to fileupload.

Eg: in submit button click event

if (Session["abc"] != null && Session["abc"].ToString()!="")
        {
            filUpld= (FileUpload)Session["abc"];
        }

then use filUpld as usual


这篇关于选择下拉列表时FileUploadControl值丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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