Question

I am using mvc asp.net trying to get data from form with FormCollection

this is my code in my view:

<input disabled="disabled" id="resultHome" name="resultHome"/>

this is the code used in my controller

[AcceptVerbs(HttpVerbs.Post)]
    public ActionResult addStatistic(StatisticModel model, FormCollection form)
    {
        string goaltimeHome = form["resultHome"];
    }

the value is always null. Can anyone help please

Thanks

Was it helpful?

Solution

Browsers do not submit the values of disabled controls. Create a hidden field that contains the value you want posted to your controller.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top