what happens behind model passing in ASP MVC4

后端 未结 2 1270
闹比i
闹比i 2021-01-25 20:50

Learning the ASP MVC now, just my 3rd week on MVC

I did some tests on modeling pass, basically the controller just get the model, and pass into the view without doing an

2条回答
  •  清酒与你
    2021-01-25 20:55

    You need to have getter and setter for ViewModel in order to retrieve the values from posted form.

    public class ViewModel
    {
        public string str1 { get; set; }
        public string str2 { get; set; }
        public List list { get; set; }
    }
    

提交回复
热议问题