CuteWebUI.AttachmentItemCollection does not give me access to AttachmentItem

Last post 09-28-2012, 4:11 AM by trbox. 2 replies.
Sort Posts: Previous Next
  •  09-26-2012, 9:29 AM 74778

    CuteWebUI.AttachmentItemCollection does not give me access to AttachmentItem

    Hi!

     

    I am uploading several files to my site, and then I'm trying to access these files in the codebehind. The problem is that I am not given access to the AttachmentItem in the codebehind. This is how it looks in the .aspx file:

    1. <CuteWebUI:UploadAttachments runat="server" ID="binaryAttachment" InsertButtonID="btnMultipleAttachment" >
    2. </CuteWebUI:UploadAttachments>    
    3.   
    4. <asp:Button ID="btnSubmitMultiple" runat="server" Text="Submit" visible="true" Enabled="true" OnClick="btnSubmitMultiple_Click" />  

     Here is the codebehind:

    1. protected void btnSubmitMultiple_Click(object sender, EventArgs e) {    
    2.       CuteWebUI.AttachmentItemCollection AIC = binaryAttachment.Items;      
    3.       CuteWebUI.AttachmentItem item = AIC.Item[1];     
    4. }  
    The problem is that when I access the AttachmentItemCollection object, I don't get the option of choosing the Item property of the object (the wanted solution is shown above). According to the documentation, this object should contain the Item. Disregard the square brackets after AIC.Item, since I don't know if they are right or wrong. They are just there to show what I would like to achieve.

     

    Is this problem maybe related to installing the wrong version of ajaxuploader, or can anyone provide me with a solution/explanation?

     

    Any help would be greatly appreciated!

     

    -trbox 

  •  09-26-2012, 11:25 AM 74780 in reply to 74778

    Re: CuteWebUI.AttachmentItemCollection does not give me access to AttachmentItem

    Hi,

     

    Please try the example below. It shows you how to get the upload files info after uploaded.

     

    1. <%@ Page Language="C#" %>  
    2.   
    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 void uploader1_UploadCompleted(object sender, UploaderEventArgs[] args)  
    8.     {  
    9.         btnSubmit.Visible = true;  
    10.     }  
    11.   
    12.     protected void btnSubmit_Click(object sender, EventArgs e)  
    13.     {  
    14.         for (int i = 0; i < uploader1.Items.Count; i++)  
    15.         {  
    16.             label1.Text += uploader1.Items[i].FileName;  
    17.             label1.Text += "<br/>";  
    18.         }  
    19.     }  
    20. </script>  
    21.   
    22. <html xmlns="http://www.w3.org/1999/xhtml">  
    23. <head runat="server">  
    24.     <title>example</title>  
    25. </head>  
    26. <body>  
    27.     <form id="form1" runat="server">  
    28.         <CuteWebUI:UploadAttachments ID="uploader1" runat="server" OnUploadCompleted="uploader1_UploadCompleted">  
    29.         </CuteWebUI:UploadAttachments>  
    30.         <asp:Button ID="btnSubmit" runat="server" Text="Get upload file info" Visible="false" OnClick="btnSubmit_Click" />  
    31.         <br />  
    32.         <asp:Label ID="label1" runat="server"></asp:Label>  
    33.     </form>  
    34. </body>  
    35. </html>  
     

    Regards,

     

    Ken 

  •  09-28-2012, 4:11 AM 74808 in reply to 74780

    Re: CuteWebUI.AttachmentItemCollection does not give me access to AttachmentItem

    Thank you so much! It works perfectly now.
View as RSS news feed in XML