How about. I am developing a web application in Mvc, and it is a medical calculator, where the user enters certain values, the account is made, and a value is returned. In the cases where the entry has to be with decimals, I get the following error:
El diccionario de parámetros contiene una entrada NULL para el parámetro 'globroj' del tipo que no acepta valores NULL 'System.Decimal' del método 'System.Web.Mvc.ActionResult CalcularHematocritos(System.Decimal, System.Decimal)' en 'Griersonmvc.Controllers.HomeController'. Un parámetro opcional debe ser un tipo de referencia, un tipo que acepte valores NULL o debe declararse como parámetro opcional.Nombre del parámetro: parameters
With the rest of the numbers, it's perfect. probe putting the point in the number instead of the comma, but neither. I leave the form and the driver of this case ..
thanks!
[HttpPost]
public ActionResult CalcularHematocritos(decimal globroj, decimal volsan)
{
decimal resultadoh = (globroj / volsan)*100;
ViewBag.Resultadoh = resultadoh;
return View("resultadoh");
}
And the HTML is this
<form action="@Url.Action("CalcularHematocritos" , "Home")" method="post">
<div>
<label for="number">
<span class="required">Volumen de Globulos Rojos *</span>
<input type="number" step="0.01" id="globroj" name="globroj" value="" placeholder="Vol. Glob. Roj." required="required" tabindex="1" autofocus="autofocus" />
</label>
</div>
<br>
<div>
<label for="number">
<span class="required">Volumen Sangre</span>
<input type="number" step="0.01" id="volsan" name="volsan" value="" placeholder="Vol. San." tabindex="2" required="required" />
</label>
<div>
<button name="submit" class="btn btn-success" type="submit" id="submit">Calcular </button>
</div>
</div>
</form>
</article>