开发者

ASP.NET - fileupload using input file

开发者 https://www.devze.com 2023-01-10 18:55 出处:网络
I am using VS-2005. In my website I have used the html input control with type=file. The problem is that when I place this control inside an \'UpdatePanel\' the \'PostedFile\' property becomes \'Not

I am using VS-2005.

In my website I have used the html input control with type=file.

The problem is that when I place this control inside an 'UpdatePanel' the 'PostedFile' property becomes 'Nothing' on postback. So in order to get things working I have removed the 'UpdatePanel' and things are working fine.

However, I am interested to know what kind of workaround is required if I were to use an 'UpdatePanel'? In one of the threads at forums.asp.net I found that开发者_开发知识库 we need to set a 'PostBackHandler' for the update panel. I have no idea how to implement this. Does it refer to 'AsyncPostbackTrigger' or 'SyncPostBackTrigger'?

Can someone give an idea how to implement this?


I was able to resolve the issue.

Instead using an AsyncPostbackTrigger I used a PostbackTrigger inside the UpdatePanel for the Upload button and this resolved the issue. Another alternative was to add a line inside the PageLoad as ScriptManager1.RegisterPostbackControl(id of upload button) and inside the button click eventhandler of the Upload button first check If Page.IsPostback.

Both the alternatives work fine!

BYE

0

精彩评论

暂无评论...
验证码 换一张
取 消