Control layout (UI editing)

Last post 07-21-2010, 1:09 PM by Eric. 3 replies.
Sort Posts: Previous Next
  •  07-14-2010, 12:58 PM 62491

    Control layout (UI editing)

    The progress bar is left-justified, how can I center it?
     
    When a file is "attached" (multiple file upload), a remove link is provided, which does remove the file from the temp directory, but I also want to remove the file that I copied into the destination directory, as well as subtract total bytes from the database.  How can I trap the removal of a file so I can do that additional processing?
  •  07-15-2010, 5:27 PM 62522 in reply to 62491

    Re: Control layout (UI editing)

    Dear Customer,
     
    Please try the following code:
    <%@ Page Language="C#" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

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

        void Attachments1_AttachmentAdded(object sender, AttachmentItemEventArgs args)
        {
            InsertMsg(args.Item.FileName + " has been uploaded.");
        }
        void Attachment1_AttachmentRemove(object sender, AttachmentItemEventArgs args)
        {
            InsertMsg(args.Item.FileName + " has been removed.");
        }    
        void ButtonDeleteAll_Click(object sender, EventArgs e)
        {
            InsertMsg("Attachments1.DeleteAllAttachments();");
            Attachments1.DeleteAllAttachments();
        }
        void ButtonTellme_Click(object sender, EventArgs e)
        {
            ListBoxEvents.Items.Clear();
            foreach (AttachmentItem item in Attachments1.Items)
            {
                InsertMsg(item.FileName + ", " + item.FileSize + " bytes.");
                //Copies the uploaded file to a new location.
                //item.CopyTo("c:\\temp\\"+item.FileName);
                //You can also open the uploaded file's data stream.
                //System.IO.Stream data = item.OpenStream();
               
            }
          }
    </script>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Uploading multiple files like GMail</title>
        <link rel="stylesheet" href="demo.css" type="text/css" />
    </head>
    <body>
        <form id="form1" runat="server">
            <div class="content">
                <h2>
                    Uploading multiple files like GMail</h2>
                <p>
                    Google's GMail has a nice way of allowing you to upload multiple files. Rather than
                    showing you 10 file upload boxes at once, the user attaches a file, you can click
                    a button to add another attachment.
                </p>
                <br />
                <CuteWebUI:UploadAttachments InsertText="Upload Multiple files Now" runat="server"
                    ID="Attachments1" MultipleFilesUpload="true" OnAttachmentRemoveClicked="Attachment1_AttachmentRemove" OnAttachmentAdded="Attachments1_AttachmentAdded">
                    <InsertButtonStyle />
                </CuteWebUI:UploadAttachments>
                <br />
                <br />
                <asp:Button ID="ButtonDeleteAll" runat="server" Text="Delete All" OnClick="ButtonDeleteAll_Click" />&nbsp;&nbsp;
                <asp:Button ID="ButtonTellme" runat="server" Text="Show Uploaded File Information"
                    OnClick="ButtonTellme_Click" />
                <br />
                <br />
                <div>
                    Server Trace:
                    <br />
                    <asp:ListBox runat="server" ID="ListBoxEvents" Width="400"></asp:ListBox>
                </div>
            </div>
        </form>
    </body>
    </html>
    Regards,
    Eric
  •  07-20-2010, 11:53 AM 62635 in reply to 62491

    Re: Control layout (UI editing)

    How can I center the progress bar?
  •  07-21-2010, 1:09 PM 62658 in reply to 62635

    Re: Control layout (UI editing)

    Please try the following code:
     

    <%@ Page Language="C#" %>

    <!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 OnLoad(EventArgs e)
        {
            base.OnLoad(e);       
            Attachments1.ProgressPanelStyle.CssClass = "ProgressStyle";      
        }
    </script>

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Uploading multiple files like GMail</title>
        <style type="text/css">   
         .ProgressStyle
         {
              margin:5px auto; width:400px; height:100px;
         }    
        </style>   
    </head>
    <body>
        <form id="form1" runat="server">      
                <CuteWebUI:UploadAttachments InsertText="Upload Multiple files Now" runat="server"
                    ID="Attachments1" MultipleFilesUpload="true" >               
                </CuteWebUI:UploadAttachments>          
        </form>
    </body>
    </html>

     
    Regards,
    Eric
View as RSS news feed in XML