Questions tagged [custom-model-binder]

The custom binding class needs to inherit form IModelBinder. Here we capture the current request and extract the Form fields individually. Then we can manipulate these fields any way we like.

Useful links

176 questions
0
votes
0 answers

Set custom model binder for single property

I have an ASP.NET Core 1.1 API that takes in a DTO parameter called DetParameterCreateDto. The problem I am having is that one of the property names is dynamic (instrument_complete). The name is actually [instrument]_complete where [instrument] is…
Eitan K
  • 837
  • 1
  • 17
  • 39
0
votes
0 answers

Custom type conversion in model binding (ASP.NET MVC)

I have a form that submits several string values. My model has one custom type ("Service"). Application gives error while trying to convert a string value to "Service". I am new to MVC. I appreciate your help! Controller (Orders/Create): //…
Ned
  • 1,055
  • 9
  • 34
  • 58
0
votes
1 answer

RecyclerView works with custom object when I add it to the list manually, but not when I instantiate it with data from RESTful service

I'm working on a project in Android Studio were I would need to list several movies in a RecyclerView (in this case from RESTful API several means 20). Now I have set everything up and my static dummy content is displayed within recyclerview using…
0
votes
1 answer

ModelState.IsValid is false prior to validation

We wrote a custom model binder that overrides the CreateModel method of the ComplexTypeModelBinder so that we can have injection into our ViewModels instead of having to pass the injected clients and repos to our model from the controller. For…
Serj Sagan
  • 28,927
  • 17
  • 154
  • 183
0
votes
1 answer

Custom Model Binder for List nested inside a wrapper model

I have the following model: public class SidebarViewModel { public SidebarViewModel() { Filters = new List(); } public List Filters { get; set; } } And each Filter looks like this: public…
0
votes
2 answers

How can I determine the default value of an optional parameter in a custom model binder?

I've got an action method like this: Function Index(Optional MyBoolean As Boolean = True) As ActionResult and a custom model binder that handles integer values, so that I can invoke this like so: /controller/Index?MyBoolean=1 My model binder, in…
Joshua Frank
  • 13,120
  • 11
  • 46
  • 95
0
votes
1 answer

ASP.NET: Modelbinder only delegating

I'm facing a problem ith a custom modelbinder. I have two models (inheriting from a base class) that are displayed by EditorTemplates. Base-Class: public abstract class QuestionAnswerInputModel { public Guid QuestionId { get; set; …
Tobias
  • 2,945
  • 5
  • 41
  • 59
0
votes
2 answers

AttemptedValue of ValueProviderResult returns wrong value

I've used ASP.NET MVC5 in my project and I've used custom model binding in it. when I'm getting the value of IsActive property in my model, I faced a problem.IsActive value must be "true" or "false" but I got "true,false" How can I get the correct…
x19
  • 8,277
  • 15
  • 68
  • 126
0
votes
2 answers

KendoUI grid does not fire saveChanges event ( System.MissingMethodException: Cannot create an instance of an interface.)

KendoUI grid does not fire SaveChanges event. I did not see any problem in Environment of Visual Studio 2013 and browsers(FF, IE, Chrome) when I run the project and clicked on SaveChanges button but SaveChanges event does not fire. For further…
0
votes
0 answers

Integration between custom DecimalModelBinder and IValidatableObject.Validate

I'm working with MVC custom validation server side and as i have to use several custom attribute. I'd like to implement the interface ValidatableObject because I think it is easier way then writing several custom attributes. To force the…
0
votes
2 answers

Model availability inside ActionFilter

I have created a new ActionFilter for an ASP.NET MVC application that I'm creating. I have an action which accepts an Http Post and the argument of the action method accepts an object, for which I have created and registered a custom model binder. I…
Sayed Ibrahim Hashimi
  • 43,864
  • 17
  • 144
  • 178
0
votes
1 answer

Two field with same name in Custom model binder

I write a custom model binder. In my page I have a numeric text box that has comma separetor mask. For examle: 1,234 In my model binder, I get value in text box: var valueResult =…
Tavousi
  • 14,848
  • 18
  • 51
  • 70
0
votes
3 answers

MVC : How to use database to drive validation attributes, or ALTERNATIVES?

In summary, I'm trying to create instance-specific data-annotation attributes at runtime, based on database fields. What I have now works fine for creating the initial model, but falls over when the model is posted-back and the server-validation…
Dave R
  • 1,626
  • 19
  • 28
0
votes
1 answer

Custom Model Binder not updating

I've been working on an MVC project that has a complex model with several nested classes, and one class has another class nested in it. I can get all of the other complex types to update correctly, but this last one never updates correctly. I've…
jwheron
  • 2,553
  • 2
  • 30
  • 40
0
votes
1 answer

What method or property should be overwritten in custom Model Binding?

I have a custom binding scenario for an MVC app that requires two pieces of functionality 1) A generic, reusable custom binder that allows mapping of form/query properties to class properties. 2) A class specific custom binder that splits a given…
Jason
  • 2,806
  • 2
  • 28
  • 38
1 2 3
11
12