0

I have created an input i html to pass double value into the controller:

The Controller method has the parameter, double value)

But it is only working with integer value in the input field anyway. If a value of 88.9 is typed into the input field above it pass 0 to the controller, why?

How to pass double parameter from html input to the controller?

  • using HTML: but it not working – Johan Lång Jun 15 '19 at 13:35
  • check decimal format in region setting and see whether it's `,` or `.` or `/` – Elyas Esna Jun 15 '19 at 13:44
  • 1
    Post a valid example of what you did already. – Filip Cordas Jun 15 '19 at 14:45
  • @JohanLång You might want to look at questions like https://stackoverflow.com/questions/25536790/asp-net-mvc-5-double-value-always-0-0-in-controller or https://stackoverflow.com/questions/32908503/c-sharp-mvc-controller-cannot-get-decimal-or-double-values-from-ajax-post-reques since it might be a CultureInfo problem. – Progman Jun 15 '19 at 19:19
  • Ok, thanks! I just added the line in Startup.cs: Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-GB"); – Johan Lång Jun 24 '19 at 10:19

0 Answers0