I am inserting a kendo dropdown control inside an upload template so that the user can select a document type for each file uploaded. The upload control allows multiple files, it is not async. It works the first time but subsequent files do not render the dropdown, only a text box instead of a dropdown list.
Here's my razor code:
<div>
@(Html.Kendo().Upload().Name("upload")
.Multiple(true)
.TemplateId("UploadTemplate"))
</div>
Here's my template:
<script id="UploadTemplate" type="text/x-kendo-template">
<span class='k-progress'></span>
<div><label>Name:</label>#=name#</div>
<div><label for='NewDoc_Type_DocumentTypeId'>Document Type:</label>
@(Html.Kendo().DropDownList()
.Name("NewDoc.Type.DocumentTypeId")
.HtmlAttributes(new { name = "NewDoc.Type.DocumentTypeId", style = "width: 260px;" })
.BindTo(DocumentTypes())
.DataTextField("DocumentTypeText")
.DataValueField("DocumentTypeId")
.Events(e => e.Select("TypeSelected")).ToClientTemplate()
)
</div>
<div style='display: none;' id='divTypeOther'>
<label for='NewDoc_TypeOther'>Document Type - Other: </label>
<input type='text' name='NewDoc.TypeOther' id='NewDoc_TypeOther' />
</div>
</script>
Also, I want to show a text box of "Other" when the user selects "OTHER" from the dropdown. Again, it works on the first one but the ids are the same starting with the second one so it wouldn't work.