This used to work.
<AcceptVerbs(HttpVerbs.Post)> _
Function Widget(ByVal collection As FormCollection) As ActionResult
...
If ... Then
ModelState.AddModelError(...)
ModelState.SetModelValue("Gadget", collection.ToValueProvider("Gizmo"))
Return View()
End If
...
End Function
I upgraded to ASP.NET MVC 2 Beta and ASP.NET MVC 2 Futures Assembly for Beta and now ToValueProvider()
fails with this compile-time error:
Interface 'System.Web.Mvc.IValueProvider' cannot be indexed because it has no default property
How do I use ModelState.SetModelValue()
if not with collection.ToValueProvider()
?