开发者

ASP.NET FileUpload : not work if there's validator?

开发者 https://www.devze.com 2023-01-04 05:42 出处:网络
i\'ve the following code: <asp:UpdatePanel runat=\"server\" ID=\"upPanelFoto\"> <ContentTemplate>

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="btnCa开发者_高级运维ricaImmagine" 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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消