在Update Panel 控件里面添加 File Upload 控件 上传文件

Detail Information:http://www.codeproject.com/Articles/482800/FileplusUploadplusinplusUpdateplusPanel

http://aspsnippets.com/Articles/Using-FileUpload-Control-inside-ASP.Net-AJAX-UpdatePanel-Control.aspx

必须设置PostBackTrigger 属性

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">

            <ContentTemplate>

                <asp:FileUpload ID="fileUploadImage" runat="server"></asp:FileUpload>

                <asp:Button ID="btnUpload" runat="server" Text="Upload Image" OnClick="btnUpload_Click" />

                <br />

                <asp:Button ID="btnProcessData" runat="server" Text="Process Data" OnClick="btnProcessData_Click" /><br />

                <asp:Label ID="lblMessage" runat="server" Text="Image uploaded successfully." Visible="false"></asp:Label><br />

                <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">

                    <ProgressTemplate>

                        Please wait image is getting uploaded....

                    </ProgressTemplate>

                </asp:UpdateProgress>

                <br />

                <b>Please view the below image uploaded</b><br />

                <asp:Image ID="img" runat="server" Width="100" Height="100" ImageAlign="Middle" />

            </ContentTemplate>

            <Triggers>

                <asp:PostBackTrigger ControlID="btnUpload"  />

                <asp:AsyncPostBackTrigger ControlID="btnProcessData" />

            </Triggers>

 </asp:UpdatePanel>
View Code

 

你可能感兴趣的:(upload)