Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @page "/DataBinding"
- <p>Enter your name: <input type="text" @bind="Name" /><br />
- What is your age? <input type="number" @bind="Age" /><br />
- What is your birthday (culture-invariant default format)? <input type="text" @bind="Birthday" /><br />
- Are you an administrator? <input type="checkbox" @bind="IsAdmin" /><br />
- <select id="select-box" @bind="TypeOfEmployee">
- <option value=@EmployeeType.Employee>@EmployeeType.Employee.ToString()</option>
- <option value=@EmployeeType.Contractor>@EmployeeType.Contractor.ToString()</option>
- <option value=@EmployeeType.Intern>@EmployeeType.Intern.ToString()</option>
- </select>
- What is your salery? <input type="number" @bind="Salary" /><br />
- </p><h2>Hello, @Name!</h2>
- <p>You are @Age years old. You are born on the @Birthday. You are @TypeOfEmployee with @Salary salary.</p>
- @if (IsAdmin){
- <p>You are an administrator!</p>
- }
- @code {
- private enum EmployeeType { Employee, Contractor, Intern };
- private EmployeeType TypeOfEmployee { get; set; } = EmployeeType.Employee;
- private string Name { get; set; } = "Mahdi";
- private bool IsAdmin { get; set; } = true;
- private int Age { get; set; } = 28;
- public DateTime Birthday { get; set; } = DateTime.Now;
- public decimal Salary { get; set; }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement