Adding extra information causes my upload control to lose InitialFileInputsCount

Thread is closed for posting
2 posts, 0 answers
  1. Shane P
    Shane P avatar
    86 posts
    Member since:
    Sep 2012

    Posted 08 Oct 2008 Link to this post

    Hi everyone,
    I have copied the code from here http://www.telerik.com/help/aspnet-ajax/upload_raduploadaddinginformation.html and the extra field is been added and I can see the value on postback serverside. However my InitialFileInputsCount is been changed from 4 to 2 and I dont know why.

    Can anyone see what is wrong?

    Here is my code.
        <telerik:RadUpload ID="RadUpload1" Runat="server" InitialFileInputsCount="4" MaxFileInputsCount="4"   
        OnClientAdded="OnClientAddedHandler" 
     ControlObjectsVisibility="None"  > 
     <script type="text/javascript">  
         var numberOfCustomFields = 0;  
         function OnClientAddedHandler(sender, eventArgs) {  
             var inputRow = eventArgs.get_row();  
             var uList = inputRow.parentNode;  
             var count = 0;  
     
             // add a new row for a Title field  
             newRow = document.createElement("li");  
             count++;  
             uList.insertBefore(newRow, inputRow);  
             var label = document.createElement("span");  
             label.innerHTML = "Name ";  
             label.style.fontSize = 12;  
             input = document.createElement("input");  
             input.type = "text";  
             input.id = input.name = sender.getID("ImageName");  
             newRow.appendChild(label);  
             newRow.appendChild(input);  
     
             //add a File label in front of the file input  
             var fileInputSpan = inputRow.getElementsByTagName("span")[0];  
             label = document.createElement("span");  
             label.innerHTML = "File ";  
             label.style.fontSize = 12;  
             inputRow.insertBefore(label, fileInputSpan);  
             numberOfCustomFields = count;  
         }  
     
    </script> 

    Thank you
  2. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 13 Oct 2008 Link to this post

    Hi Shane,

    The reason for this is that the MaxFileInputsCount property counts the number of <LI> elements of the UL list of RadUpload so you need to add <LI> elements with attention. Check the online example for another approach.

    All the best,
    Veselin Vasilev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top