Hi
Please check this sample :
- <%@ Page Language="C#" %>
-
- <%@ Register TagPrefix="CuteWebUI" Namespace="CuteWebUI" Assembly="CuteWebUI.AjaxUploader" %>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
- <script runat="server">
-
- int uploadedcount = 0;
- protected void Uploader1_FileUploaded(object sender, UploaderEventArgs args)
- {
- uploadedcount++;
- }
-
- protected void SubmitButton_Click(object sender, EventArgs e)
- {
- servermsg.Text = "You have uploaded " + uploadedcount + " files";
- }
- </script>
-
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head runat="server">
- <title>Sample</title>
-
- <script type="text/javascript">
- var submitbtnid="<%=SubmitButton.ClientID %>";
- var uploaderid="<%=Uploader1.ClientID %>";
- var ispostback=false;
- var isuploading=false;
- function CuteWebUI_AjaxUploader_OnQueueUI(list)
- {
- var uploader=this;
- var submitbtn=document.getElementById(submitbtnid);
- if(list.length==0)
- {
- uploader.internalobject.insertBtn.style.display="";
- submitbtn.style.display="none";
- }
- else
- {
- uploader.internalobject.insertBtn.style.display="none";
- if(isuploading)
- submitbtn.style.display="none";
- else
- submitbtn.style.display="";
- }
- }
-
- function Submit_ClientClick()
- {
- if(ispostback)
- return true;
- var uploader=document.getElementById(uploaderid);
- var submitbtn=document.getElementById(submitbtnid);
- uploader.startupload();
- submitbtn.style.display="none";
- return false;
- }
- function CuteWebUI_AjaxUploader_OnPostback()
- {
- isuploading=false;
- var submitbtn=document.getElementById(submitbtnid);
- ispostback=true;
- submitbtn.click();
- return false;
- }
- function CuteWebUI_AjaxUploader_OnStart()
- {
- isuploading=true;
- }
- function CuteWebUI_AjaxUploader_OnStop()
- {
- isuploading=false;
- }
- </script>
-
- </head>
- <body>
- <form id="form1" runat="server">
- <div>
- Select Files
- <hr />
- <CuteWebUI:Uploader runat="server" ID="Uploader1" ManualStartUpload="true" MultipleFilesUpload="true"
- InsertText="Browse" OnFileUploaded="Uploader1_FileUploaded" />
- <hr />
- <asp:Button runat="server" ID="SubmitButton" Text="Submit" Style="display: none;" OnClientClick="return Submit_ClientClick()" OnClick="SubmitButton_Click" />
- </div>
- <asp:Label runat="server" ID="servermsg" ForeColor="red" Font-Bold="true" />
- </form>
- </body>
- </html>
Regards,
Terry