Use Json and AjaxLink to Toggle Link Values in ASP.NET MVC 2
问题 I have a list of Child objects. I would like to be able to toggle whether they are included in a smaller list of objects which have a relationship to a Parent object. Like so: <% foreach(var child in Model.AllPossibleChildren)%> <% { %> <tr> <td> <%if(child.Link.Any(r => r.Id == Model.Parent.Id)) { %> <%:Ajax.ActionLink("Remove", "RemoveChild", new { aId = Model.Parent.Id, rId = child.Id }, null)%> <% } else { %> <%:Ajax.ActionLink("Add", "AddChild", new { aId = Model.Parent.Id, rId = child