2

ドロップダウン リストの @html ヘルパーに変換するには、次のものが必要です。

<select size="30" class="scrollableinside" id="CustomerSelect">
    @foreach (var customer in Model.Customers)
    { 
        <option  value=@customer.CustomerContacts.First().CustomerContactID>@customer.CustomerName &#09;&emsp;&#09; @customer.CustomerContacts.First().Phone</option>
    }
</select>

私は .First() と 2 つのデータをリストに入れることでこれを少し非正統的にやっているので、これのために @Html.SelectListFor を作成する方法がよくわかりません。

@Html.DropDownListFor(model => model.CustomerID, new SelectList(Model.Customers, "CustomerID", "What do I put here"))
4

2 に答える 2

-1
@Html.DropDownListFor(model => model.CustomerID,new SelectList(Model.Customers, "datavaluefield","datatextfield", Model.CustomerID))
于 2013-04-05T06:06:54.207 に答える