We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

DropDownList doesn't work with list in form

Thread ID:

Created:

Updated:

Platform:

Replies:

131209 Jun 28,2017 10:47 AM UTC Jun 29,2017 12:17 PM UTC ASP.NET Core 1
loading
Tags: DropDownList
Zhen Liu
Asked On June 28, 2017 10:47 AM UTC

I have a form which consists a list of dropdown boxes, the code below using <select> works, but when I try to use DropDownList, it doesn't render properly.

<form asp-action="Confirm">
    <div class="form-horizontal">
        <div asp-validation-summary="ModelOnly" class="text-danger"></div>
        <input type="hidden" asp-for="BlobName" />
        <table class="table">
            <thead>
                <tr>
                    <th>
                        Unknown Contacts
                    </th>
                    <th>
                        Solution
                    </th>
                </tr>
            </thead>
            <tbody>
                @for (int i=0; i < Model.ContactConfirmation.Count;i++)
                {
                    <tr>
                        <td>
                        <input type="text" name="confirmation.ContactConfirmation[@i].UnmatchContactName" asp-for="@Model.ContactConfirmation[i].UnmatchContactName" class="form-control" readonly />
                        </td>
                        <td>
                            <select name="confirmation.ContactConfirmation[@i].NewContactName" asp-for="@Model.ContactConfirmation[i].NewContactName" asp-items="@ViewBag.contacts"></select>   
                        </td>
                    </tr>
                }
            </tbody>
        </table>

        <div class="form-group">
            <div class="col-md-offset-2 col-md-10">
                <input type="submit" value="Confirm" class="btn btn-default" />
            </div>
        </div>
    </div>
</form>

Keerthana Rajendran [Syncfusion]
Replied On June 29, 2017 12:17 PM UTC

Hi Zhen, 
 
Thank you for contacting  Syncfusion support . 
 
We have prepared a sample based on your code and rendered our ejDropDownList inside for loop. Please refer the below given code 
 
<tbody> 
                @for (int i = 0; i < Model.band.Count; i++) 
                { 
                    
                    <tr> 
                        <td> 
                            @{Html.EJ().DropDownListFor(model=>model.band[i].display,(Syncfusion.JavaScript.Models.DropDownListProperties)ViewData["ddl"]).Width("100%").Render();} 
 
                        </td> 
                    </tr> 
               } 
 
 
            </tbody> 
 
 
We have attached sample for your reference. Kindly refer to the below given link 
 
 
 
Regards, 
Keerthana. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;