Note that there are some explanatory texts on larger screens.

plurals
  1. POASP.NET MVC 2 problem with UpdateModel
    primarykey
    data
    text
    <p>I'm trying to use updatemodel(myItem, formcollection) with asp.net mvc 2 but it fails with the stack trace below.</p> <pre><code> at System.Web.Mvc.FormCollection.GetValue(String name) at System.Web.Mvc.DefaultModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) at System.Web.Mvc.Controller.TryUpdateModel[TModel](TModel model, String prefix, String[] includeProperties, String[] excludeProperties, IValueProvider valueProvider) at System.Web.Mvc.Controller.TryUpdateModel[TModel](TModel model, IValueProvider valueProvider) at Stormbreaker.Dashboard.Controllers.DashboardController`1.Update(FormCollection collection) in D:\Projects\SVN\Stormbreaker\trunk\Stormbreaker.Dashboard\Controllers\DashboardController.cs:line 23 at lambda_method(ExecutionScope , ControllerBase , Object[] ) at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) at System.Web.Mvc.ControllerActionInvoker.&lt;&gt;c__DisplayClassd.&lt;InvokeActionMethodWithFilters&gt;b__a() at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) </code></pre> <p>My action looks like this:</p> <pre><code> [AcceptVerbs(HttpVerbs.Post)] [ValidateInput(false)] public ActionResult Update(FormCollection collection) { UpdateModel(CurrentItem, collection); CurrentItem = (T)_repository.Update(CurrentItem); return RedirectToAction("edit", new { pagePath = CurrentItem.UrlSegment }); } </code></pre> <p>... and my form looks like this:</p> <pre><code>&lt;% using (Html.BeginForm("Update","Dashboard", FormMethod.Post, new { name = "editForm" } )) %&gt; &lt;% { %&gt; &lt;div&gt; &lt;%=Html.EditorForModel() %&gt; &lt;input type="submit" value="Save" /&gt; &lt;/div&gt; &lt;% } %&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload