As everybody knows that FileUpload control doesn’t work inside update panel, there are some work around and in fact I have posted post about that as well. Here is my post link just in case you got here and wants to know more about that.
I have file upload control in user control and have update panel in aspx page so I can’t really add postbacktrigger in ascx page because I don’t have control on updatepanel. So I have to specify in code behind to do full postback. Here is the code that I have put in code behind.
But I was facing some weird issue. When I submit the page first time, file upload control’s PostedFile(Filebytes/fileName) property returns nothing. But second time and subsequent submit, file upload controls works fine and PostedFile property returns proper value. Isn’t it weird? (I think so…)
To fix this weird issue all you need to do is set encoding type to “multipart/form-data”. You can set it from code behind using
Page.Form.Enctype = “multipart/form-data”;
Hope this helps. If this post really helps you, please click the Google +1 button to show it really helps you save your time.