Advertisement
Guest User

Untitled

a guest
Aug 24th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. @page "/DataBinding"
  2. <p>Enter your name: <input type="text" @bind="Name" /><br />
  3. What is your age? <input type="number" @bind="Age" /><br />
  4. What is your birthday (culture-invariant default format)? <input type="text" @bind="Birthday" /><br />
  5. Are you an administrator? <input type="checkbox" @bind="IsAdmin" /><br />
  6. <select id="select-box" @bind="TypeOfEmployee">
  7. <option value=@EmployeeType.Employee>@EmployeeType.Employee.ToString()</option>
  8. <option value=@EmployeeType.Contractor>@EmployeeType.Contractor.ToString()</option>
  9. <option value=@EmployeeType.Intern>@EmployeeType.Intern.ToString()</option>
  10. </select>
  11. What is your salery? <input type="number" @bind="Salary" /><br />
  12. </p><h2>Hello, @Name!</h2>
  13. <p>You are @Age years old. You are born on the @Birthday. You are @TypeOfEmployee with @Salary salary.</p>
  14. @if (IsAdmin){
  15. <p>You are an administrator!</p>
  16. }
  17. @code {
  18. private enum EmployeeType { Employee, Contractor, Intern };
  19. private EmployeeType TypeOfEmployee { get; set; } = EmployeeType.Employee;
  20. private string Name { get; set; } = "Mahdi";
  21. private bool IsAdmin { get; set; } = true;
  22. private int Age { get; set; } = 28;
  23. public DateTime Birthday { get; set; } = DateTime.Now;
  24. public decimal Salary { get; set; }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement