質問

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

役に立ちましたか?

解決

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

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top