Multiple models in a view

前端 未结 12 1834
太阳男子
太阳男子 2020-11-21 23:07

I want to have 2 models in one view. The page contains both LoginViewModel and RegisterViewModel.

e.g.

pub         


        
12条回答
  •  梦如初夏
    2020-11-21 23:31

    1. Create one new class in your model and properties of LoginViewModel and RegisterViewModel:

      public class UserDefinedModel() 
      {
          property a1 as LoginViewModel 
          property a2 as RegisterViewModel 
      }
      
    2. Then use UserDefinedModel in your view.

提交回复
热议问题