defaultmodelbinder Questions

2

I'm creating a custom model binder for a view model, implementing IModelBinder I have a lot of properties in my view model, the majority of which do not need any custom binding. Rather than explic...

5

Solved

I have a Person class with a BornDate property in my model defined as [DisplayName("Born Date")] public DateTime? BornDate { get; set; } I use this field in my view as <td style="white-spac...
Cephalalgia asked 10/9, 2010 at 10:55

3

Solved

When I send a list of int's with jQuery like this: $.ajax('@Url.Action("Execute")', { type: 'POST', data: { pkList: [1,2,3] } }); Then jQuery will transform the pkList object and send it by ...
Rapport asked 28/10, 2011 at 16:5

1

Solved

I am trying to bind a string route parameter to Enum Type like below public static async Task<HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = "Valid...

6

Solved

Is it true that the default model binder in MVC 3.0 is capable of handling non-sequential indices (for both simple and complex model types)? I've come across posts that suggest it should, however i...
Milker asked 22/12, 2011 at 0:49

6

Solved

I have a custom model class which contains a decimal member and a view to accept entry for this class. Everything worked well till I added javascripts to format the number inside input control. The...
Thaumatology asked 16/6, 2009 at 6:6

3

I'm using ASP.NET MVC3 and i'm wondering that the default modelbinder binds to public properties but not to public fields. Normally i just define the model classes with properties but sometimes i ...
Moneybag asked 19/12, 2011 at 9:6

2

Solved

Ok, this is weird. I cannot use BindAttribute's Include and Exclude properties with complex type nested objects on ASP.NET MVC. Here is what I did: Model: public class FooViewModel { public En...
Refractive asked 17/1, 2012 at 9:52

3

For number of years I did ASP.NET web forms development I was spoiled by a proprietary library, which allowed me to do things like: UpdateToObject(ControlsCollection, obj) UpdateFromObject(Contr...
Pindaric asked 9/9, 2010 at 20:43

3

I am trying to get ASP.NET MVC 3 to generate forms from complex, nested objects. There is one validation behaviour I found which was unexpected and I am not sure if it's a bug in the DefaultModelBi...
Quentin asked 20/3, 2012 at 6:52

2

I have a model like so: class Model { public IList<Item> Items { get; set; } } class Item { public int Id { get; set; } } I am sending a request to an action method that takes a Model as...
Calie asked 7/1, 2013 at 20:1

1

Solved

So I'm trying to apply Darin Dimitrov's answer, but in my implementation bindingContext.ModelName is equal to "". Here's my viewmodel: public class UrunViewModel { public Urun Urun { get; set; }...
Fairway asked 6/7, 2012 at 21:35

5

I have a very simple class: public class FilterItem { public Dictionary<string, string> ItemsDictionary { get; set; } public FilterItem() { ItemsDictionary = new Dictionary<string, s...
Disgorge asked 12/8, 2011 at 16:0

3

I have a controller action whose definition looks like- public ActionResult ChangeModel( IEnumerable<MyModel> info, long? destinationId) And the model: public class MyModel { public stri...

2

Solved

I've got the following model class (stripped for simplicity): public class Info { public int IntData { get; set; } } Here's my Razor form that uses this model: @model Info @Html.ValidationSumm...
Virgievirgil asked 6/6, 2011 at 12:40

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

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 have a View with a table representing an employee's timesheet. Days across the top, projects down the side, with each day/project intersection containing two values for regular hours and overtime...
Assimilable asked 16/6, 2009 at 21:54

5

Solved

When I use the default model binding to bind form parameters to a complex object which is a parameter to an action, the framework remembers the values passed to the first request, meaning that any ...
1

© 2022 - 2024 — McMap. All rights reserved.