Forums - C# Corner

Forum guidelines

View With Switch case to Display for every Model

May 21 2019 11:44 PM
Hi, everyone is possible to write a single view with Switch case having all controls and display those controls on the view depending on the Model Properties
 
Let Say I have the following properties and Models
  1. public class Employee{  
  2. public int Id {getset;}  
  3. public string Name {getset;}  
  4. public string Email {getset;}  
  5. }  
  6. and another class  
  7. public class Department{  
  8. public int Id {getset;}  
  9. public string DepartmentName {getset;}  
  10. }  
then if I want to have two forms from the View Employee form and Department for example is it possible to write one View with all controls so that when I click Employee only controls for Employee appear on screen same applies to Department or any other Model using one view.
 
Thanks

Answers (3)