<pre lang="c#"> <tr> <td> <%Html.Label("FromCity"); %> </td> <td> <select id="Select1"> <option></option> </select> <%Html.DropDownList("City"); %> <%--<%Html.DropDownListFor("ddlCity",new SelectList(ViewData["City"].ToString(),"CityId","CityName"));%>--%> </td> </tr>
ViewData["City"].ToString()
ViewData["City"] as IEnumerable <SelectListItem>
<%Html.DropDownListFor("ddlCity",new SelectList(ViewData["City"] as IEnumerable <SelectListItem>,"CityId","CityName"));%>
ViewBag.City= new SelectList(db.Cities, "Id", "Name");
<%Html.DropDownList("City"); %>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)