Here's what I'm trying to do :
I have an entity Task with a TaskName property and a TaskPriority property.
Now, in the html I have :
<td><%=Html.TextBox("Task.TaskName") %></td>
<td><%=Html.DropDownList("Task.TaskPriority",new SelectList(ViewData.Model.TaskPriorities,"ID","PriorityName")) %></td>
The Controller action is like this :
public ActionResult Create(Task task){
//task.TaskName has the correct value
//task.TaskPriority is null - how should the html look so this would work ?
}
EDIT In the example bellow (from Schotime) :
public class Task
{
public int name { get; set; }
public string value { get; set; } // what if the type of the property were Dropdown ?
// in the example I gave the Task has a property of type: TaskPriority.
}