Bind drop down with preselected value
Hello,I have an issue with binding drop down with selected value.I am using list to generate dropdown with selected value on cshtml page or view. When my first loop is complete, my dropdown is bind properly, but i just want to select ID of loop in bind drop down.I tried like :-
<tbody>
@for (int i = 0; i < Model.LeaveClass.Count; i++)
{
<tr><td>
@Html.DropDownListFor(m => m.LeaveClass[i].ID, new selectList(Model.LeaveTypes, "Text", "Value"), "Select")
</td></tr>
}
</tbody>