C
cksanjose
I'm trying out ASP.Net MVC (Release Candidate). I'm trying to render a
dropdownlist. My code below will not display a dropdownlist.
My controller has this code block:
var clients = from client in vetData.Clients
orderby client.ClientId
select client;
ViewData["clientlist"] = new SelectList(clients.ToList(),
"ClientId", "FirstName");
return View();
My view has this code block:
<tr>
<td>Client</td>
<td><%
var clients = ViewData["clientlist"] as
IEnumerable<SelectListItem>;
Html.DropDownList("clients", clients);
%></td>
dropdownlist. My code below will not display a dropdownlist.
My controller has this code block:
var clients = from client in vetData.Clients
orderby client.ClientId
select client;
ViewData["clientlist"] = new SelectList(clients.ToList(),
"ClientId", "FirstName");
return View();
My view has this code block:
<tr>
<td>Client</td>
<td><%
var clients = ViewData["clientlist"] as
IEnumerable<SelectListItem>;
Html.DropDownList("clients", clients);
%></td>