This is a migrated thread and some comments may be shown as answers.

Adding extra information causes my upload control to lose InitialFileInputsCount

1 Answer 39 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Shane P
Top achievements
Rank 1
Shane P asked on 08 Oct 2008, 07:05 PM
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

1 Answer, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 13 Oct 2008, 09:33 AM
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.
Tags
Upload (Obsolete)
Asked by
Shane P
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Share this question
or