customize the attachement view table

Last post 07-06-2009, 10:44 AM by sancho. 4 replies.
Sort Posts: Previous Next
  •  06-29-2009, 12:20 PM 53596

    customize the attachement view table

    I have requiremnt to customize the uploading. I want to add a Description textbox for each file I'm uploading. I need a textbox after each filename in the table once it is attached and before start uploading. A;lso, I need to show these description when the upload is completed and after postback. How can I do that? Please help
  •  06-29-2009, 9:23 PM 53617 in reply to 53596

    Re: customize the attachement view table

    Hi,
     
    1. You can use the UploadAttachments.ItemTemplate to place your special cell .
     
    2. You can even render another datagrid , please check this sample:
     
    1. <%@ Page Language="C#" %>  
    2. <%@ Register TagPrefix="CuteWebUI" Namespace="CuteWebUI" Assembly="CuteWebUI.AjaxUploader" %>  
    3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
    4.   
    5. <script runat="server">  
    6.   
    7.     protected override void OnPreRender(EventArgs e)   
    8.     {   
    9.         base.OnPreRender(e);   
    10.   
    11.         //hide the default table   
    12.         UploadAttachments1.GetItemsTable().Visible = false;   
    13.         //bind the grid every times   
    14.         DataGrid1.DataSource = UploadAttachments1.Items;   
    15.         DataGrid1.DataBind();   
    16.         DataGrid1.Visible = UploadAttachments1.Items.Count > 0;   
    17.     }   
    18.        
    19.     protected void DataGrid1_ItemCommand(object sender, System.Web.UI.WebControls.DataGridCommandEventArgs e)   
    20.     {   
    21.         Guid guid = (Guid)DataGrid1.DataKeys[e.Item.ItemIndex];   
    22.         foreach (AttachmentItem item in UploadAttachments1.Items)   
    23.         {   
    24.             if (item.FileGuid == guid)   
    25.             {   
    26.                 if (e.CommandName == "Download")   
    27.                 {   
    28.                     using (Stream str = item.OpenStream())   
    29.                     {   
    30.                         Response.AddHeader("Content-Disposition", "attachment; filename='" + item.FileName+"'");   
    31.                         Response.AddHeader("Content-Length", item.FileSize.ToString());   
    32.                         byte[] buff = new byte[4096];   
    33.                         while (true)   
    34.                         {   
    35.                             int rc = str.Read(buff, 0, buff.Length);   
    36.                             if (rc == 0)   
    37.                                 break;   
    38.                             Response.OutputStream.Write(buff, 0, rc);   
    39.                         }   
    40.                     }   
    41.                 }   
    42.   
    43.                 if (e.CommandName == "Remove")   
    44.                 {   
    45.                     item.Remove();   
    46.                 }   
    47.   
    48.                 break;   
    49.             }   
    50.         }   
    51.     }   
    52.        
    53. </script>  
    54.   
    55. <html xmlns="http://www.w3.org/1999/xhtml">  
    56. <head runat="server">  
    57.     <title>DataGridCS</title>  
    58. </head>  
    59. <body>  
    60.     <form id="form1" runat="server">  
    61.         <div>  
    62.                
    63.             <CuteWebUI:UploadAttachments runat="server" ID="UploadAttachments1" UploadType=Flash>  
    64.             </CuteWebUI:UploadAttachments>  
    65.             <hr />  
    66.             <asp:DataGrid ID="DataGrid1" runat="server" AutoGenerateColumns="false" DataKeyField="FileGuid" OnItemCommand="DataGrid1_ItemCommand">  
    67.                 <Columns>  
    68.                     <asp:BoundColumn DataField="FileGuid" HeaderText="File Guid" />  
    69.                     <asp:BoundColumn DataField="FileName" HeaderText="File Name" />  
    70.                     <asp:BoundColumn DataField="FileSize" HeaderText="File Size" />  
    71.                     <asp:ButtonColumn CommandName="Remove" Text="Remove" />  
    72.                     <asp:ButtonColumn CommandName="Download" Text="Download" />  
    73.                 </Columns>  
    74.             </asp:DataGrid>  
    75.         </div>  
    76.     </form>  
    77.        
    78. </body>  
    79. </html>  

    Regards,
    Terry
     
  •  07-03-2009, 4:58 PM 53721 in reply to 53617

    Re: customize the attachement view table

    Is this necesary to display the table in pages (like in the file storage demo: http://ajaxuploader.com/Demo/Ajax-based-File-storage.aspx)?

    How can I display the queue table in pages for manual upload? Is there a way to hide and replace the queue table?

     

    Thanks :)

  •  07-03-2009, 9:40 PM 53723 in reply to 53721

    Re: customize the attachement view table

    Hi,
     
    For the queue table, please check this :
     
     
    Regards,
    Terry
     
  •  07-06-2009, 10:44 AM 53763 in reply to 53723

    Re: customize the attachement view table

    Thank you :)
View as RSS news feed in XML