How to pass model from view to controller when click button in MVC?

后端 未结 2 707
梦如初夏
梦如初夏 2020-12-12 06:58

Index - View

@model SendAFaxWeb.Models.Send
//view start here

    

Test Upload File

2条回答
  •  一整个雨季
    2020-12-12 07:26

    You can do it using the below code

    @model PK.LifeStyles.Web.Models.Reimbursement //model declaration on top
    
    

    Your code behind should look something like this

        public ActionResult Save(Reimbursement data)
        {
          // your  code
        }
       //just some random class
       public class Reimbursement{
             public string Destination { get; set; }
       }
    

提交回复
热议问题