문제

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