Click here to Skip to main content
15,881,715 members
Articles / Web Development / ASP.NET

Showing File Upload Progress to the user using UpdatePanel control in ASP.NET

Rate me:
Please Sign up or sign in to vote.
4.38/5 (8 votes)
17 Dec 2012CPOL2 min read 47.8K   2.8K   13  
This article describes the working of fileupload inside an updatepanel and showing the file upload progress to the user.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
        </div>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <table style="border-right: #ff0033 2px solid; border-top: #ff0033 2px solid; border-left: #ff0033 2px solid;
                    border-bottom: #ff0033 2px solid">
                    <tbody>
                        <tr>
                            <td style="font-size: 15pt; color: silver; background-color: #ff0033" align="center"
                                colspan="3">
                                Demo : Using Fileupload in Updatepanel with UpdateProgress</td>
                        </tr>
                        <tr>
                            <td align="center" colspan="3">
                                <asp:Label ID="Label1" runat="server"></asp:Label></td>
                        </tr>
                        <tr>
                            <td valign="top">
                                <asp:FileUpload ID="FU1" runat="server"></asp:FileUpload>
                            </td>
                            <td valign="top">
                                <asp:Button ID="Upload" OnClick="Upload_Click" runat="server" Text="Upload"></asp:Button></td>
                            <td colspan="1" rowspan="1">
                                <asp:Image ID="ImageView" runat="server" Width="100" Height="100"></asp:Image></td>
                        </tr>
                        <tr>
                            <td align="center" colspan="3">
                                <asp:Button ID="Button1" OnClick="Button1_Click" runat="server" Text="Process Data">
                                </asp:Button>
                                <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
                                    <ProgressTemplate>
                                        <img src="Image/saving.gif" style="width: 43px; height: 39px" alt="" />
                                    </ProgressTemplate>
                                </asp:UpdateProgress>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click"></asp:AsyncPostBackTrigger>
                <asp:PostBackTrigger ControlID="Upload"></asp:PostBackTrigger>
            </Triggers>
        </asp:UpdatePanel>
        
    </form>
</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
India India
I am a Software Engineer from Bhopal. I started my Career from Programming in ASP and now working as a Web Developer in ASP.Net (C#). I Love coding and always ready to gain new thing and always been towards Microsoft Technologies. Apart from coding my other hobbies are traveling, Internet Surfing, spending time with family and hang out with friends.

http://www.webtekspace.blogspot.in/

Comments and Discussions