I have totally 5 models in my application. I have an "index.cshtml" page which has kendo panel bar. I referred each model in each kendo panel bar. So instead of doing like this now I want group all this 5 models into a single class files as "Mainmodel". Also I should pass only this model to controller. controller which in turn separate this models into 5 model.

public class MainModel
  public Model1 firstmodel{get; set;}
  public Model2 secondmodel{get; set;}
  public Model3 thirdmodel{get; set;}
  public Model4 fourthmodel{get; set;}
  public Model5 fifthtmodel{get; set;}

I want to use this "main" model in view. how to do this.??

    public class Model1
    public string name {get; set;}
   public class Model2
    public string DOB{get; set;}


    @model mvc.Models.MainModel

    @using (Html.Beginform("SaveData","Home"))
       .content(@html.textboxfor(x=> x. /// here I did not get any properties that I have created name,DOB


 //My controller

    public Actionresult SaveData(MainModel mainmodel)
    retun view("Index",mainmodel);

How to use this properties in MainModel inside index.cshtml?

Related posts

Recent Viewed