Note that there are some explanatory texts on larger screens.

plurals
  1. POMVC 3 custom ModelBinder not being used
    primarykey
    data
    text
    <p>I have a form that posts a bunch of hidden variables, some with the same name. Here's the post body:</p> <pre><code>OfferId=3802&amp;DeliveryDate=11%2F02%2F2011&amp;DeliveryTime=12%3A00&amp;location=1&amp;location=698 </code></pre> <p>It posts it to an MVC action:</p> <pre><code>[HttpPost] public ActionResult DeliveryOptions(DeliveryOptions model) { ... } </code></pre> <p>The DeliveryOptions model looks like this:</p> <pre><code>public class DeliveryOptions { public long? OfferId { get; set; } [CustomValidation(typeof(CustomValidator), "IsDeliveryDateValid")] public DateTime? DeliveryDate { get; set; } public DateTime? DeliveryTime { get; set; } [CustomValidation(typeof(CustomValidator), "IsLocationsValid")] public OfferLocations Locations { get; set; } } </code></pre> <p>Now, I would like to parse the posted <code>location</code> variables into the OfferLocations object, which looks like this:</p> <pre><code>[ModelBinder(typeof(OfferLocationsModelBinder))] public class OfferLocations { [Required] public int[] LocationIds { get; set; } } </code></pre> <p>The model binder currently looks like this:</p> <pre><code>public class OfferLocationsModelBinder : IModelBinder { public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) { throw new NotImplementedException(); } } </code></pre> <p>The problem is, I cannot break on the NotImplementedException. The model binder does not execute. I've probably missed something obvious; any ideas?</p>
    singulars
    1. This table or related slice is empty.
    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.
    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