Problem with FileUpload control

Posted by Samirg under ASP.NET AJAX on 10/12/2012 | Points: 10 | Views : 1696 | Status : [Member] | Replies : 5
Hi All,

I have a situation where I have a Asp.Net FileUpload control and a Button control on the page. There is also a UpdatePanel on the page which encloses some div tags. The problem is that whenever user clicks the button, the page posts back and the FileUpload control loses all the information. Below is the code for the same,

<div id="fileLoadProgress" class="slidingPanel" style="">
<asp:FileUpload ID="FileUploader" runat="server" />
<asp:Button ID="btnUpload" runat="server" Text="Upload" Height="20px" OnClick="btnUpload_Click" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div>
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left">
<div id="progressbar" style="width: 250px; height: 18px;">
</div>
</td>
<td>
<div id="dvProgressPrcent">
0%
</div>
</td>
<td>
<div id="infoBar">
</div>
</td>
</tr>
</table>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnUpload" EventName="Click" />
</Triggers>
</asp:UpdatePanel>


I have gone through some articles on internet which stated that FileUpload control is not compatible with UpdatePanel and requires full postback. However my requirement doesn't permit me to do a full postback.

I came across one article which says that enclosing the FileUpload control and the Button in an iFrame can do the job.

However I have a doubt that how this can be done and if I implement it in that way, how can I then update the div tags which are present in the UpdatePanel. How will I be able to link the controls on main page to the controls on iFrame?

Thanks in advance.




Responses

Posted by: Bageshkumarbagi on: 10/14/2012 [Member] Starter | Points: 25

Up
0
Down
hi Samirg
for using any ajax control fiest you need to take ScriptManager.then only your UpdatePanel will be work.

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>

Thanks,
Bagesh Kumar Singh
Mark as answer if you have been satisfied

Samirg, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bageshkumarbagi on: 10/14/2012 [Member] Starter | Points: 25

Up
0
Down
if your program executed successfully then Mark as answer.

Thanks,
Bagesh Kumar Singh
Mark as answer if you have been satisfied

Samirg, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vinay13mar on: 10/14/2012 [Member] Starter | Points: 25

Up
0
Down

Posted by: Samirg on: 10/15/2012 [Member] Starter | Points: 25

Up
0
Down
Hi Bagesh, I have the script manager on my aspx page, though it is not shown here in the code...

Samirg, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Samirg on: 10/15/2012 [Member] Starter | Points: 25

Up
0
Down
@Vinay, Thanks for the link. I read the article you had suggested but that is not the functionality I am expecting. I want to show the progress bar in real time as the file uploads without making any postback.

Samirg, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response