I have submit form in View
where price fields can be null.
I get values in action with Request.Form[]
:
int? min = int.Parse(Request.Form["min"])
but I get Exception when the field is null because null can't be parsed in int.
Anything else to try?
Test if the value is null before parsing
int? min = null;
if (Request.Form["min"] != null)
{
min = int.Parse(Request.Form["min"])
}