- @using (Html.BeginForm())
- {
- <table>
- <tr>
- <td>
- @Html.DropDownList("Shifts", ViewBag.ShiftData as SelectList, "--Select shifts--", new { })</td>
- </tr>
- </table>
- }
- <table>
- <tr>
- <td><select id="Shifts" name="Shifts"><option value="">--Select shifts--</option>
- <option value="1">Shift-A</option>
- <option value="2">Shift-B</option>
- <option value="3">Shift-C</option>
- <option value="4">Shift-D</option>
- <option value="5">Shift-E</option>
- </select></td>
- </tr>
- </table>
- - The first option is taken for name and id.
- <td>@Html.DropDownListFor(m=>m.ShiftId,ViewBag.ShiftData as SelectList,"--Select shifts--",new{})</td>
- <td>
- <select data-val="true" data-val-number="The field ShiftId must be a number." data-val-required="The ShiftId field is required." id="ShiftId" name="ShiftId"><option value="">--Select shifts--</option>
- <option value="1">Shift-A</option>
- <option value="2">Shift-B</option>
- <option value="3">Shift-C</option>
- <option value="4">Shift-D</option>
- <option value="5">Shift-E</option>
- </select>
- </td>
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment
It is the same account you read, post and publish with — and you will come straight back to this page.


Ankush BandPosted Nov 30, 2015, 5:29 AM
nice example
Gowtham RajamanickamPosted Jul 9, 2015, 12:31 AM
Good one