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
2 answers

make django look for data in my custom model

i am new to django and concept i am trying is very simple. I created the custom model(i dont want to extend any pre-defined model). And using this code i tried to authenticate my login : Models.py : (i have given just sample data here. This is not…
0
votes
1 answer

Should I use custom model binder to bind view model to entity?

Just some idea to make more use of custom model binder. I am currently still using IMapper interface to do so, though wondering whether part of the purpose of custom binder is to mapping view model or input model to business entity? I can see there…
0
votes
1 answer

A Strongly Types Partial View which is dynamically model binded at runtime to 2 different model class

There is main RegisterModel calling nested HomeAddress and MailAddress model. public class RegisterModel { Public string FirstName {get; set;} Public string LastName {get; set;} Public HomeAddressModel homeAddress {get; set;} Public…
0
votes
1 answer

In ASP.NET MVC 4, is there a way I can add a custom DateTime model binder for a single action?

I'm trying to bind a form to a model parameter in a controller. The model contains a DateTime field and I'd like that to be bound when the form is submitted. The form field expects the date to be input in a non-standard format (which I can't change…
dommer
  • 19,610
  • 14
  • 75
  • 137
0
votes
2 answers

How to use a custom binder to normalize user input?

Based on user input, I want to nullify some properties of an entity before it gets to the controller's Action. In a crude example (the real model is a lot more complicated), let's say my entity have a BillingType property that defines if the client…
Henrique Miranda
  • 1,030
  • 1
  • 13
  • 31
0
votes
1 answer

Receiving complex data via WebAPI action

I'm needing a way to convert a complex web request into .Net objects. I understand that WebAPI uses a default model binder, and that for complicated data, a custom model binder is needed. Objects Public Class LapMobileModel Public Property Type…
Christopher Stevenson
  • 2,843
  • 20
  • 25
0
votes
0 answers

How do I retrieve my custom object from the bindingContext?

The problem I am having is that the Custom Model Binder is null when I try to retrieve by GetValue("Budget") but as you can see, the binder contains the prefix. I also get all the keys if I look in the metadata i have them there, but still NULL.…
n3tx
  • 429
  • 2
  • 10
  • 23
0
votes
0 answers

Custom modelbinder results in new database insert

I've got this issue in ASP.NET MVC model binding. I have an address object with a country child object. However - I'm using auto-complete for the country name. So in my view I've got something like this: @Html.EditorFor(model => model.Country) And…
Jochen van Wylick
  • 5,303
  • 4
  • 42
  • 64
0
votes
2 answers

Choosing object binder in action signature

I have a custom model binder to get data from session, but I also would like to use the default binder from time to time. Is it possible to choose model binder in action signature instead of using UpdateModel? Example public ViewResult MyAction(Cart…
-1
votes
1 answer

How can I control the attempted value for a custom model binder?

I've got an action with a signature like this: public ActionResult Index([ModelBinder(typeof(MyEnumModelBinder))] MyEnum myEnum) Which is implemented like this: public class MyEnumModelBinder: IModelBinder { public object…
RPM1984
  • 72,246
  • 58
  • 225
  • 350
-1
votes
1 answer

Transferring observable array to controller along with model

I want to transfer observable array along with model to controller. I did my surfing and found custom model binding is good for my situation. But again its given I can use controllerContext.HttpContext.Form.Get("Day"); where as Day is Day I have…
1 2 3
11
12