Submitting Form in MVC 4 model is null in controller post method

前端 未结 3 1976
粉色の甜心
粉色の甜心 2021-01-02 09:42

So my problem right now is that I cant get my model into my controller when I submit this following form. I am trying to have the items from the BillingCodes (which is a lis

3条回答
  •  执笔经年
    2021-01-02 10:06

    Your View is type of BillingCodeList, but you are trying to send List to you action in controller.

    Try to change action as follows:

    [HttpPost]
        public void SubmitTimesheet(BillingCodeList model)
        {
    
            string uri = "";
    
            foreach (var billingCode in model.BillingCodes)
            {
               //do stuff with each of these
            }
        }
    

提交回复
热议问题