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 in my tests it appears that it does NOT.
Given post…
Is there any way to get posted files () to take part in model binding in ASP.NET MVC without manually looking at the request context in a custom model binder, and without creating a separate action method which only takes a…
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 post like…
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 explicitly set all of the property values on my model…
I have a controller action whose definition looks like-
public ActionResult ChangeModel( IEnumerable info, long? destinationId)
And the model:
public class MyModel
{
public string Name; //Gets populated by default binder
public…
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 format code format the inputted number with…
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.
The (simplified) class definitions for the page…
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 Enquiry Enquiry { get; set; }
}
public class Enquiry…
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 DefaultModelBinder or not.
If I have two objects, lets call the…
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.ValidationSummary()
@using (Html.BeginForm())
{
…
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; }
public Type UrunType { get; set; }
}
Here's…
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.Billing.Address.City
Order.Billing.Address.Country
Using…
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 use some predefined classes which contains some…
I have a very simple class:
public class FilterItem
{
public Dictionary ItemsDictionary { get; set; }
public FilterItem()
{
ItemsDictionary = new Dictionary();
}
}
I want to populate the data…
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(ControlsCollection, obj)
Conceptually code did…