modelbinders Questions

3

Solved

I'm scratching my head a bit at how model binders do their work in ASP.Net MVC. To be specific, the BindModel() method has a ModelBindingContext parameter that holds the model name and type, but ...
Ernaline asked 19/8, 2010 at 16:6

1

Solved

I've been reading PRO ASP.NET MVC2 by Steven Sanderson and I still can't figure out something about session. In the book he tells how to develop a Cart based on session using a Custom model binder ...
Floyfloyd asked 29/5, 2011 at 0:38

3

Solved

I have an input form that is bound to a model. The model has a TimeSpan property, but it only gets the value correctly if I enter the time as hh:mm or hh:mm:ss. What I want is for it to capture the...
Timmi asked 30/9, 2010 at 15:32

1

Solved

I have a few questions regarding custom model binding, model state, and data annotations. 1) Is it redundant to do validation in the custom model binder if I have data annotations on my model, bec...

4

Solved

I want to use RenderPartial twice in my view with different models associated. The problem is that some properties are present in both models (nickname, password). They have no prefix, so even the ...

1

I have what I would think is a somewhat normal situation where I need to bind form posts to an "order" model. This model has a few levels of information to it: Order.Billing.FirstName Order.Billin...
Karrikarrie asked 16/2, 2010 at 14:23

2

Solved

I would like to know how i can bind my form values to my strongly typed view from a MultiSelect box. Obviously when the form submits the multi-select box will submit a delittemered string of my va...

2

Solved

I need to wire my custom ModelBinder up to my DI container in MVC 3, but I can't get it working. So. This is what I have: A ModelBinder with a constructor injected service. public class ProductMo...
Tillfourd asked 8/12, 2010 at 20:35

2

Solved

I'm creating a custom model binder in an Mvc application and I want to parse a string to an enumeration value and assign it to the model property. I have got it working overriding the BindProperty ...
Panfish asked 11/2, 2010 at 15:51

1

Solved

I am building an MVC application and am designing a custom model binder for a class; Essentially one of the fields of the model is an object that exists in the database, but it is proving very diff...
Contentious asked 11/11, 2010 at 21:27

2

Solved

In my application, I am trying to split the Date and Time from and DateTime field so I can put a jQuery date picker on the date. I found Hanselman's code for splitting the DateTime, however I get a...
Ancestor asked 10/11, 2010 at 22:37

2

Solved

I am attempting to bind a list that is part of a larger view model without resorting to a custom model binder. When I use an editor template to build the list of inputs, the generated names are not...
Aceae asked 17/10, 2010 at 0:28

1

Solved

i've created my own custom model binder to handle a Section DropDownList defined in my view as: Html.DropDownListFor(m => m.Category.Section, new SelectList(Model.Sections, "SectionID", "Sectio...

2

I have a controller action that looks like: public ActionResult DoSomethingCool(int[] someIdNumbers) { ... } I would like to be able to use a custom model binder the create that array of IDs fr...
Homogeny asked 1/9, 2010 at 22:14

2

Solved

In my ASP.NET MVC site, part of a feature allows the user to enter the hours when a certain venue is open. I've decided to store these hours in a VenueHours table in my database, with a FK-to-PK r...
Sup asked 17/6, 2010 at 3:8

1

Solved

I am using custom model binder in ASP.NET MVC 2 that looks like this: public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) { if (controllerC...
Bulla asked 6/4, 2010 at 21:47

2

Solved

I have a list of items in my form which are named like this... <input type="text" id="ListItem1" name="ListItem1"> <input type="text" id="ListItem2" name="ListItem2"> <input type="t...
Decompress asked 29/3, 2010 at 10:19

1

Solved

I would like to create model binding functionality so a user can enter ',' '.' etc for currency values which bind to a double value of my ViewModel. I was able to do this in MVC 1.0 by creating a ...
Gonad asked 16/3, 2010 at 10:36

3

Solved

I have a type: public class IssueForm { Order Order {get; set;} Item Item {get; set;} Range Range {get; set;} } I created a custom model binder due to requirements on Order and Item, but Rang...
Perpetuate asked 9/6, 2009 at 14:17

2

Solved

I've wrote custom model binder in project, that uses ASP.NET MVC 2. This model binder bind just 2 fields of model: public class TaskFormBinder : DefaultModelBinder { protected override void BindP...
Infamy asked 2/1, 2010 at 19:50

3

Solved

I am attempting to upgrade my MVC 1 project to MVC 2 RC. We currently have a custom modelbinder that adds items to the ValueProvider (this worked when it was a dictionary). We then passed this off ...
Polyandrous asked 24/12, 2009 at 16:44

2

Solved

I am having more than a little difficulty trying to debug why MVC is not binding correctly in a given case I have... Basically, I have my action which receives a complex object which in turn has a...
Uyekawa asked 4/11, 2009 at 21:27

4

Solved

Is there any way to get posted files (<input type="file" />) to take part in model binding in ASP.NET MVC without manually looking at the request context in a custom model binder, and without...

2

I am trying to get UpdateModel to populate a model that is set as only an interface at compile-time. For example, I have: // View Model public class AccountViewModel { public string Email { get; ...
Herdsman asked 9/9, 2009 at 16:30

1

Solved

I've got a series of views, each are typed to have their own ViewModel class which contains everything they need to display themselves, for example: public class CreateResourceViewModel { public ...
Flann asked 14/8, 2009 at 11:58

© 2022 - 2024 — McMap. All rights reserved.