I've finally gotten this working after days of struggle.

I've got a simple database of People and Departments:

ADO.NET Entity Framework Entity Data Model diagram with Department and Person objects http://img39.imageshack.us/img39/1368/edmxdepartmentperson.gif

I can use strongly-typed ASP.NET MVC views for reference/navigation properties! See the list of departments...

ASP.NET MVC with DropDownList http://img11.imageshack.us/img11/7619/dropdownlistdepartment.gif

Part of my Person/Edit view:

<% using (Html.BeginForm()) {%>
    <%= Html.Hidden("Id", Model.Id) %>
    <fieldset>
        <legend>Fields</legend>
        <p>
            <label for="Name">Name:</label>
            <%= Html.TextBox("Name", Model.Name) %>
        </p>
        <p>
            <label for="DepartmentId">Department:</label>
            <%= Html.DropDownList("DepartmentId", new SelectList((IEnumerable)ViewData["Departments"], "Id", "Name"))%>
        </p>
        <p>
            <input type="submit" value="Save" />
        </p>
    </fieldset>
<% } %>

Part of my Person controller:

//
// GET: /Person/Edit/5

public ActionResult Edit(Guid id)
{
    ViewData["Departments"] = ctx.Department;
    Person model = (from Person p in ctx.Person
                    where p.Id == id
                    select p).FirstOrDefault();
    return View(model);
}

//
// POST: /Person/Edit

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Edit(Person model)
{
    ctx.AttachUpdated(model);  //extension
    ctx.SaveChanges();
    return RedirectToAction("Index");
}

To get this working, I

Edit
Report