Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
In a update panel, I am displaying a gridview, and div body which is invisibe unless add button is clicked. On add button click event the controls in the div tag will be made visible. This div body has some textboxes,dropdown lists, 2 file upload controls, 2 calender controls.Problem faced:
1. On selecting the calender date, the top upload controls fields are getting cleared.
2. Tried changing the upload controls to bottom, but in codebehind uploadcontrol.hasfile is always getting null.
3. tried setting postback trigger to the upload control. but the page is displayed blank.
4. gone through iframes solution,but found complex to understand
5. tried placing seperate button to upload. but in codebehing btn.hasfile returns false
Posted

just add the following code into your application.
that will cuse the panel to postback and eventuly the fileupload control will strat working.

C#
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="conditional">
 <Triggers>
  <asp:PostBackTrigger ControlID="Button1" />
 </Triggers>
 
Share this answer
 
v2
yup i will also try that but FileUpload.HasFile always return false;
when i placed FileUpoad control inside a update panel...
 
Share this answer
 
From :
XML
http://knowledgebaseworld.blogspot.in/2009/02/file-upload-not-working-with-update.html


In problem definition we come to know that form must be encoded with multipart/form-data if we want to upload the file; solution is very simple, we just need to change encoded attribute of form with following single line!!!

Page.Form.Attributes.Add("enctype", "multipart/form-data");
 
Share this answer
 
Al ready tried this does not work at all,
any idea why?
Thanks
 
Share this answer
 
Comments
[no name] 15-Aug-12 20:18pm    
How exactly is this an answer to this over year old question?

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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