0

i've the following code:

   <asp:UpdatePanel runat="server" ID="upPanelFoto">
                    <ContentTemplate>

                        <asp:FileUpload onChange="CaricaFileImmagine();" ID="FileUpload1" runat="server" BorderStyle="Solid" />
                        &nbsp;<asp:Button ID="btnCaricaImmagine" runat="server" Text="Carica" CssClass="Pulsanti" />
                    </ContentTemplate>
                    <Triggers>
                        <asp:PostBackTrigger ControlID="btnCaricaImmagine" />
                    </Triggers>
                </asp:UpdatePanel>

In the same page i've some asp.net fieldvalidator (to validate other field). When i click "btnCaricaImmagine" that function never is called, and field validator appear on the screen...

How can i do to load my file ? Thanks

stighy
  • 7,260
  • 25
  • 97
  • 157

1 Answers1

0

The validator will need to be within the update panel, as will whatever control it is validating.

However, there isn't much point putting a file upload in an update panel as it cause a full postback anyway (hence why you've used the postback trigger). Look at the AsyncFileUpload control or SWFUpload for async uploads.

David Neale
  • 16,498
  • 6
  • 59
  • 85
  • i'm trying also with AsyncFileUpload but it still don't work... mmmm – stighy Jun 19 '10 at 19:24
  • Did you put the `AsyncFileUpload` inside an UpdatePanel? It shouldn't be in one. It still won't fire your validator control's events though. – David Neale Jun 20 '10 at 11:46