Questions tagged [imodelbinder]
27 questions
1
vote
1 answer
Make Web API IModelBinder apply to all instances of the type
I'm using a custom IModelBinder to try to convert strings into NodaTime LocalDates. My LocalDateBinder looks like this:
public class LocalDateBinder : IModelBinder
{
private readonly LocalDatePattern _localDatePattern =…

Joshua Barron
- 1,532
- 2
- 26
- 42
1
vote
3 answers
ASP.NET MVC3 Custom Model Binder Issues
I have an applicant model that contains a list of tags:
public class Applicant
{
public virtual IList Tags { get; protected set; }
}
When the form is submitted, there is an input field that contains a comma-delimited list of tags the user…

arknotts
- 454
- 3
- 13
0
votes
1 answer
mvc3 IModelBinder and url
I'm having a problem using iModelBinder with url in the format of
http://localhost/controller/action/id/value
the action would be the function in the controller
the id/value is ie. id=12
When I try the above link i receive a 404 error page not…

Vince
- 165
- 1
- 14
0
votes
1 answer
Model binding for the multiple partial views in dotnet core
I want to design common model binding using one common partial view and other multiple partial views based on the model type with different model binding.
I have one base Dialog Model and two derived models.
public class DialogModel
{
public int…

Imrankhan
- 157
- 1
- 8
0
votes
1 answer
IModelBinder Delay
I have created controller that use an interface as the post parameter. Since the parameter an interface I use IModelBinder to translate the request.Body into IQuery object. The parsing by IModelBinder has no issue, and execution on Controller also…

Ariston Darmayuda
- 11
- 3
0
votes
0 answers
ASP.NET WebAPI: Bind model's property based on value in another property
Request provides a batch of messages with a different signature and provides 'metadata' of this message as well. So, example is pretty simple:
{
"SomeProp": 1,
"Messages": [{
"Type": "SomeMessage1",
"Body": {
…

dotFive
- 363
- 3
- 19
0
votes
0 answers
What is the cause of the error "IModelBinder" and how do I fix it?
I'm editing a asp.net MVC project. There is javascript that makes an ajax call to an API controller. I didn't write this ajax script and it's been working fine. I've added some models (.cs files) to the data project and all of a sudden I get this…

boilers222
- 1,901
- 7
- 33
- 71
0
votes
1 answer
ASP.NET Core - IModelBinder - Access controller DbContext
I have an MVC solution based on ASP.NET 2, with a generic controller and a custom binder.
The controller code is the following:
public class GenericController : Controller where T : BaseModel
{
public readonly AppContext Db = new…

Guido Lo Spacy
- 429
- 1
- 4
- 20
0
votes
1 answer
Mvc Bind custom form fields
I am trying to bind custom form fields to an existing ViewModel.
I have a ViewModel that looks similar to this
public class BasicProfileViewModel {
public Employee Employee { get; set; }
}
I am loading my form using the above but what i also…

R4nc1d
- 2,923
- 3
- 24
- 44
0
votes
1 answer
MVC 5 Session Variable ModelBinder null on Action Method
I am doing an MVC APP. I have a View that Inherit from Model call UserModel that have 2 properties. UserName and Password. I want to save those values in Session variables, so I am using ModelBinder.
My class definition is like this.
public class…

Diego
- 2,238
- 4
- 31
- 68
0
votes
0 answers
Achieve Default model Binding working with custom model binder in WebPI and asp.net mVC 4
I created a custom Model binder working fine with all the properties.
But the issue is I am missing the default modelbinding.
I am using DataAnotations for my objects and I want to apply my custom model binder for Enums only.
How can I achieve the…

AMDI
- 895
- 2
- 17
- 40
0
votes
2 answers
ASP MVC 3 ajax with json model binding to complex class
I have got following class hierarchy in my ASP MVC 3 project. Some entry can have containers, and that containers can have some content inside. Container and content classes are abstract classes.
I need to receive json request from browser, and…

MaciejLisCK
- 3,706
- 5
- 32
- 39