Saturday, March 24, 2012

UpdatePanel and FileUpload

Hi,

i have wide customer table that i handle with a big DetailView nested inside an UpdatePanel for faster interaction. Works like a charm.

Now they ask me to allow the user to upload a file, but when i add it in the detail view and i save data i get no file at all, as if putting it into an updatepanel do not allow him to send the file any more.

Is there some setting i have to put so to make it work ?

thanks in advance,

Fabrizio

Hi There,

This is a known ** not sure should call it issue, but callback will not work for FileUpload ( e.g. have fileupload in updatepanel )

The trick is assign postbacktrigger to the button that upload the file.

Example:

<asp:ScriptManagerID="ScriptManager1"runat="server">

</asp:ScriptManager>

<asp:UpdatePanelID="UpdatePanel1"runat="server">

<Triggers>

<asp:PostBackTriggerControlID="Button1"/>

</Triggers>

<ContentTemplate>

<asp:FileUploadID="FileUpload1"runat="server"/>

<asp:ButtonID="Button1"runat="server"Text="Button"OnClick="Button1_Click"/>

</ContentTemplate>

</asp:UpdatePanel>


Hi,

Thanks for your help, after posting i found other posts on the problem, for future references i add here another help to the problem of the button not sending the file on the first click.

try to use this

in Form tag add this

enctype="multipart/form-data"

example:

<form id="form1" enctype="multipart/form-data" runat="server">

i use that and it works

As inhttp://forums.asp.net/t/1060363.aspx?PageIndex=2


Thank you! I've been fighting with this for a week!
Thanks for the tip!!!!

No comments:

Post a Comment