Click here to Skip to main content
15,909,503 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am using fileupload control, but its getting blank after slecting dropdown,still i using upadate panel
Posted
Comments
Tejas Vaishnav 19-Jan-12 0:50am    
put your file upload control out side of update panel... you face this problem because of update panel...
Jephunneh Malazarte 19-Jan-12 1:03am    
when you select someting in your dropdown will it perform postback?
tusharN 19-Jan-12 2:35am    
ya it is getting postback
Jephunneh Malazarte 19-Jan-12 9:30am    
did you try the solution i posted if its working?
Sergey Alexandrovich Kryukov 19-Jan-12 1:08am    
Not a question, and not enough information. Can you see "Improve question" above? This is your only chance to get any useful help.
--SA

1 solution

If you want to retain your fileupload control inside updatepanel try adding Page.Form.Attributes.Add("enctype", "multipart/form-data") under Page_Load and have a PostBackTrigger for the upload button.

but if you don't want to do that just move ur fileupload control outside the panel so that when the dropdown performs a postback your fileupload will not be affected. part of implementation of microsoft for some security reason is that when page postback the values in ur fileupload control needs to reset.

refer here
fileupload control


code behind
protected void Page_Load(object sender, EventArgs e)
{
    this.Page.Form.Attributes.Add("enctype", "multipart/form-data");
}


in ui
<asp:updatepanel xmlns:asp="#unknown">
        <contenttemplate>
            ......
        </contenttemplate>
        <triggers>
            <asp:postbacktrigger controlid="btnUpload" />
        </triggers>
    </asp:updatepanel>
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900