Re: limit file number demo can't work when using personal defined insert button

  •  01-09-2012, 5:46 AM

    Re: limit file number demo can't work when using personal defined insert button

    Hi steveyuan,
     
    If you use property InsertButtonID, please set this control directly
     
    <%@ 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">
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            if (GetVisibleItemCount() >= 3)
            {
                button1.Enabled = false;
            }
            else
            {
                button1.Enabled = true;
            }
        }
        int GetVisibleItemCount()
        {
            int count = 0;
            foreach (AttachmentItem item in uploader1.Items)
            {
                if (item.Visible)
                    count++;
            }
            return count;
        }
    </script>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>example</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <div>
                <CuteWebUI:UploadAttachments ID="uploader1" runat="server" InsertButtonID="button1">
                </CuteWebUI:UploadAttachments>
                <asp:Button ID="button1" runat="server" Text="upload files" />
            </div>
        </form>
    </body>
    </html>
     
    Regards,
     
    Ken 
View Complete Thread