Hi,
Here is an example for you :
- <%@ Page Language="C#" Title="First sample" %>
- <%@ Import Namespace="CuteWebUI" %>
- <%@ Register TagPrefix="CuteWebUI" Namespace="CuteWebUI" Assembly="CuteWebUI.AjaxUploader" %>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
-
- <script runat="server">
-
- void InsertMsg(string msg)
- {
- ListBoxEvents.Items.Insert(0, msg);
- ListBoxEvents.SelectedIndex = 0;
- }
- protected void UploadAttachments1_AttachmentAdded(object sender, AttachmentItemEventArgs args)
- {
- InsertMsg("Added.." + args.Item.FileName);
- }
-
- protected void UploadAttachments1_FileValidating(object sender, UploaderEventArgs args)
- {
- if (args.FileSize == 0)
- {
- throw (new Exception("Please do not upload empty file !"));
- }
- }
- </script>
-
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head id="Head1" runat="server">
- </head>
- <body>
- <form id="Form1" runat="server">
- <CuteWebUI:UploadAttachments runat="server" ID="UploadAttachments1"
- OnAttachmentAdded="UploadAttachments1_AttachmentAdded"
- OnFileValidating="UploadAttachments1_FileValidating">
- </CuteWebUI:UploadAttachments>
- <br />
- <div>
- Server Trace:
- <br />
- <asp:ListBox runat="server" ID="ListBoxEvents" Width="800"></asp:ListBox>
- </div>
- </form>
- </body>
- </html>
Regards,
Terry