Rob,
You can't update the server UI at the FileValidating event.
Uploader provide a method to let you send some data to cient side, and then update the UI via JavaScript
Please check this sample:
- <%@ Page Language="C#" %>
-
- <%@ Import Namespace="CuteWebUI" %>
- <%@ 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">
-
- protected void UploadAttachments1_FileValidating(object sender, UploaderEventArgs args)
- {
- //you can send some data or message to client side
- UploadAttachments1.SetValidationServerData("File validated at " + DateTime.Now.ToString("HH:mm:ss"));
-
- //updating the UI has no effect!
- labelMsg.Text = "Validated!";
- }
-
- protected void UploadAttachments1_FileUploaded(object sender, UploaderEventArgs args)
- {
-
- }
- </script>
-
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head id="Head1" runat="server">
- <title>Untitled Page</title>
- </head>
- <body>
- <form id="form1" runat="server">
- <div>
- <CuteWebUI:UploadAttachments runat="server" ID="UploadAttachments1" InsertText="Add files" OnFileValidating="UploadAttachments1_FileValidating" OnFileUploaded="UploadAttachments1_FileUploaded">
- </CuteWebUI:UploadAttachments>
- <br />
- <asp:Label runat="server" ID="labelMsg" />
- </div>
- </form>
- </body>
-
- <script type="text/javascript">
- function CuteWebUI_AjaxUploader_OnTaskComplete(file)
- {
- //You can get the custom data here , (or using uploader.getitems()[i].ServerData)
- alert(file.ServerData);
- }
- </script>
-
- </html>
Regards,
Terry