custom-model-binder Questions
5
Solved
I would like to write my own model binder for DateTime type. First of all I'd like to write a new attribute that I can attach to my model property like:
[DateTimeFormat("d.M.yyyy")]
public DateTim...
Soloist asked 1/3, 2010 at 14:52
3
I have a requirement to have different forms for different clients which can all be configured in the background (in the end in a database)
My initial idea is to create an object for "Form" which ...
Fishnet asked 28/6, 2017 at 13:56
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...
Kokoruda asked 19/8, 2018 at 19:22
2
Solved
I have an endpoint in .NET 6 Microsoft.NET.Sdk.Web project that deserialize query strings into a .NET object by using the standard [FromQuery]
[Route("[controller]")]
public class Samples...
Lattice asked 6/7, 2022 at 16:6
2
Solved
Right now my ViewModel looks like this:
public class MyViewModel
{
private readonly IMyService myService;
public ClaimantSearchViewModel(IMyService myService)
{
this.myService = myService;
}...
Bryantbryanty asked 25/2, 2016 at 0:34
2
anyone has a working example of a custom model binding with polymorphic model binding? I'm trying this example (which is for Mvc not Api projects) with a web api project but it's not working for AP...
Striking asked 18/5, 2020 at 9:0
5
Solved
Getting the error here:
ValueProviderResult value = bindingContext.ValueProvider.GetValue("ConfirmationMessage");
How do I allow on a selection of values only? i.e.
[ValidateInput(false)]
publi...
Extracanonical asked 22/6, 2013 at 19:8
1
Solved
I would like to bind an object in a controller through the body of a HTTP Post.
It works like this
public class MyModelBinder : IModelBinder
{
public Task BindModelAsync(ModelBindingContext bi...
Ringo asked 22/5, 2019 at 15:27
1
Solved
I already have tried this, but I don't think it's my case. This doesn't work neither.
I'm using ASP.NET Core 2 Web API. I just created a dummy model binder (what it does doesn't matter for now):
...
Undress asked 13/4, 2019 at 19:52
2
I have written custom model binder for a property. Now I am trying to write unit test for the same but not able to create object for model binder. Can anyone help me ? Below is the code for which I...
Jaime asked 24/12, 2018 at 5:47
2
I have a simple model for my asp.net core controller:
[HttpPost]
public async Task<DefaultResponse> AddCourse([FromBody]CourseDto dto)
{
var response = await _courseService.AddCourse(dto);
...
Ninety asked 2/7, 2017 at 12:41
1
I am using a custom model binder in order to put some custom logic in my model Binding.
Here's my DTOs:
public class TaskDto
{
public int Id { get; set; }
[MaxLength(100), Required]
public st...
Sanbo asked 17/5, 2017 at 12:44
1
I have created a ModelBinder, which only gets triggered if an object has a [Decimal] attribute assigned, yet for some reason, despite it actually sanitising the data it does not seem to update the ...
Homonym asked 5/9, 2017 at 13:28
1
Solved
I have created a Custom Model Binder in .NET Core 1.x . It works well as shown in the official tutorial.
Once updated to 2.0, I can't compile it anymore. In the old version it was
return TaskCac...
Gui asked 23/8, 2017 at 12:8
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...
Bengaline asked 2/6, 2017 at 0:3
1
Solved
I have created ModelBinder for a complex class. I would like to reuse this ModelBinder on a property.
So is it possible to use ModelBinder on a property in Web API. I'm searching for an sample impl...
Eyrie asked 23/5, 2014 at 7:6
4
Solved
I have the following controller action:
[HttpPost]
public ViewResult DoSomething(MyModel model)
{
// do something
return View();
}
Where MyModel looks like this:
public class MyModel
{
publi...
Combs asked 2/2, 2010 at 19:25
1
I'm writing and ASP.NET Core 1 application, which has a Web API Controller where supplier will post data.
This is a simplified version of the Model class to which I will bind the incoming data:
p...
Relativize asked 30/9, 2016 at 14:50
1
I have a custom model binder in WebAPI that uses the following method from the `Sytem.Web.Http.ModelBinding' namespace which is the correct namespace for creating custom model binders for Web API:
...
Uppercase asked 8/4, 2016 at 16:35
1
Solved
I've created a custom MVC Model Binder which gets called for every HttpPost that comes into the server. But does not get called for HttpGet requests.
Should my custom model binder get called durin...
Florist asked 3/9, 2015 at 10:54
2
Solved
I was under the impression that model binding in the ASP.Net Web API was supposed to support binding with the same minimum level of functionality supported by MVC.
Take the following controller:
...
Restaurant asked 2/6, 2012 at 15:16
3
Solved
I want to create a website in different languages. I already read that I could create an ActionFilter, but I have a litte problem:
I had to create a custom ModelBinder in order to work with english...
Latimore asked 18/11, 2012 at 22:28
3
Solved
I started to play around with knockout.js and in doing so I used the FromJsonAttribute (created by Steve Sanderson). I ran into an issue with the custom attribute not performing model validation. I...
Dibble asked 29/12, 2011 at 14:10
2
Solved
KendoUI grid does not fire SaveChanges event.
I did not see any problem in Environment of Visual Studio 2013 and browsers(FF, IE, Chrome) when I run the project and clicked on SaveChanges button bu...
Ingenuous asked 16/9, 2014 at 1:31
2
Solved
I have a view model that implements IValidatableObject that contains a string and a collection of another view model, something like this:
public sealed class MainViewModel
{
public string Name {...
Gospel asked 3/12, 2012 at 13:33
1 Next >
© 2022 - 2024 — McMap. All rights reserved.