<%@ Page Language="c#" %>
<%@ Register Namespace="CuteWebUI" Assembly="CuteWebUI.AjaxUploader" TagPrefix="CuteWebUI" %>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head runat="server">
    <title>Selecting Multiple Files - v4 compatibility</title>
    <link rel="stylesheet" href="demo.css" type="text/css" />

    <script runat="server">
        void InsertMsg(string msg)
        {
            ListBoxEvents.Items.Insert(0, msg);
            ListBoxEvents.SelectedIndex = 0;
        }

        void ButtonPostBack_Click(object sender, EventArgs e)
        {
            InsertMsg("You clicked a PostBack Button.");
        }

        void Uploader_FileUploaded(object sender, UploaderEventArgs args)
        {
            InsertMsg("File uploaded! " + args.FileName + ", " + args.FileSize + " bytes.");
        }
    </script>
</head>
<body>
    <form id="Form1" method="post" runat="server">
        <div class="content">
            <a class="backlink" href="Default.aspx">&#8592; v4 compatibility demos</a>
            <h2>Selecting Multiple Files</h2>
            <p>With <code>MultipleFilesUpload="true"</code> the file dialog accepts a multi-file
                selection, and <code>FileUploaded</code> is raised once per file.</p>

            <div class="note">
                This is the scenario most upgraded v4 pages use, and the one to check first if
                server events are not firing: v4 always posted back when the batch finished, and
                the legacy controls restore that by forcing <code>AutoPostBack</code> on.
            </div>

            <div class="panel">
                <CuteWebUI:Uploader runat="server" ID="Uploader1"
                    InsertText="Upload Files"
                    MultipleFilesUpload="true"
                    UploadingMsg="Uploading, please wait..."
                    OnFileUploaded="Uploader_FileUploaded" />
            </div>

            <div class="panel">
                <p>Server Trace:</p>
                <asp:ListBox runat="server" ID="ListBoxEvents" />
                <p>
                    <asp:Button ID="ButtonPostBack" Text="This is a PostBack button" runat="server"
                        OnClick="ButtonPostBack_Click" />
                </p>
            </div>
        </div>
    </form>
</body>
</html>
