I am currently working on an update view for a model I have in ASP.NET MVC. The model is called Document and has child Links:
[Association(ThisKey = "AssetID", OtherKey = "AssetID")]
private EntitySet<Link> links = new EntitySet<Link>();
public IQueryable<Link> Links
{
get { return links.AsQueryable().Select(l => l); }
set
{
links.Assign(value);
}
}
I've got my strongly-typed update form rendering the model correctly (including all links) through a EditorTemplate for link and then use of Html.EditorFor(model => model.links)
. This successfully grabs and displays all links for the given Document.
When the form is submitted and I use Fiddler to see the data that is posted back, for each link it contains all the fields like Links[0].Id = 12323, Links[0].DisplayOrder = 1, etc.
The problem though is when I put a breakpoint on the controller method that I am posting to, and examine the Document object that is being posted, its Links collection is empty. I have tried adding additional binding properties to my controller as described here, but with no luck--the argument passed to the parameter is always null.
Any ideas why my model does not contain these links when I try to update it? Thanks