Questions tagged [value-provider]

39 questions
23
votes
4 answers

Accept comma and dot as decimal separator

Model binding in ASP.NET MVC is great, but it follows locale settings. In my locale decimal separator is comma (','), but users use dot ('.') too, because they are lazy to switch layouts. I want this implemented in one place for all decimal fields…
artvolk
  • 9,448
  • 11
  • 56
  • 85
20
votes
3 answers

How do I retrieve body values from an HTTP POST request in an ASP.NET Web API ValueProvider?

I want to send a HTTP POST request with the body containing information that makes up a simple blog post, nothing fancy. I've read here that when you want to bind a complex type (i.e. a type that is not string, int etc) in Web API, a good approach…
Jim Aho
  • 9,932
  • 15
  • 56
  • 87
14
votes
3 answers

Use custom ASP.NET MVC IValueProvider, without setting it globally?

I want to be able to grab keys/values from a cookie and use that to bind a model. Rather than building a custom ModelBinder, I believe that the DefaultModelBinder works well out of the box, and the best way to choose where the values come from would…
Oved D
  • 7,132
  • 10
  • 47
  • 69
9
votes
4 answers

How to map a 1 or 0 in an ASP.Net MVC route segment into a Boolean action method input parameter

We have some PHP and Javascript apps that call into some ASP.NET MVC endpoints. Let's say we have this endpoint: public ActionResult DoSomething(bool flag) { } I want it to match the value for flag whether I pass in an integer of 1 or 0, or pass…
Micah
  • 111,873
  • 86
  • 233
  • 325
8
votes
1 answer

Problem with double values binding

In my project I want to allow users input double values in 2 formats: with using ',' or '.' as delimiter (I'm not interested in exponential form). By default value with delimiter '.' don't work. I want this behavior works for all double properties…
8
votes
2 answers

ASP.NET MVC: Order of execution of ValueProviders

I like to know the order of the execution of the different ValueProviders in ASP.NET MVC. ValueProviders: QueryStringValueProvider RouteDataValueProvider FormValueProvider ... I did not find an information.
Rookian
  • 19,841
  • 28
  • 110
  • 180
6
votes
1 answer

Case Insensitive Model Binding MVC 4

I would like my model binding to be case insensitive. I tried manipulating a custom model binder inheriting from System.web.Mvc.DefaultModelBinder, but I can't figure out where to add case insensitivity. I also took a look at IValueProvider, but I…
4
votes
2 answers

ASP.NET MVC: Specify value provider on a per-action or per-route basis?

I'm trying to set up an action in ASP.NET MVC 3 to handle the payload of a mercurial webhook request - in this case, generated by Kiln. The payload is JSON, but unfortunately it is sent as a URL encoded form value with the content type…
Daniel Schaffer
  • 56,753
  • 31
  • 116
  • 165
4
votes
1 answer

How can I get valueprovider in asp.net core 1.0?

In MVC5, I used to obtain a ValueProvider within a Controller Action like this: public class ConfigurationsController : Controller { public ActionResult Index() { var valueProvider = this.ValueProvider; var someValue =…
3
votes
1 answer

MVC Routing Parameter Precedence

I came across a scenario where I had the default MVC Route setup. Like So. routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id =…
Valeklosse
  • 1,017
  • 3
  • 19
  • 36
3
votes
2 answers

Bind from custom headers and request body

I am having a problem binding a model from both custom headers and the request body at the same time. This is my model: public class TestModel { public int Id { get; set; } public string Name { get; set; } public HeaderModel…
TheGwa
  • 1,919
  • 27
  • 44
2
votes
2 answers

Testing @Default value for Beam PipelineOptions ValueProvider

I would like a Dataflow template with a default value for one of the PipelineOptions parameters. Inspired by examples online I use a ValueProvider placeholder for deferred parameter setting in my PipelineOptions "sub"-interface: …
nsandersen
  • 896
  • 2
  • 16
  • 41
2
votes
1 answer

use ValueProvider to format a BigQuery in Dataflow

I am currently working with Dataflow to do a recurrent batch processing in python. Basically I read data from bigquery and do stuff on it.. My pipeline looks like this pipeline_options = PipelineOptions() p =…
2
votes
1 answer

How to customize value setting during deserialization with contract resolver and value provider

I am failing at a task to encrypt certain fields when serializing into JSON and decrypt those fields during deserialization into a specific C# class. I reduced the problem to its most basic issue, which is that I cannot customize the deserialization…
diegosasw
  • 13,734
  • 16
  • 95
  • 159
2
votes
1 answer

Merging Value Providers in GXT 3.0

I have a grid, and ValueProviders releated to this grid. If I want to add ValueProviders to the column one by one as ColumnConfig's, then it's OK. I mean I can add the columns like Name - Surname - Adress etc. But now, I have a different case. I…
Uğurcan Şengit
  • 976
  • 1
  • 11
  • 31
1
2 3