I try to expand the server side blazor todo app.
I would like to
- add a responsible person to a todoitem
- add a todoitem after onkeyup inside the input field
This gist contains my attempt to expand the todo app
What works
Adding a list of people inside a select field
<select>
@foreach (var person in people)
{
<option value="person">@person</option>
}
</select>
What does not work
Two things are not working
- adding a person to a
todoIteminsideAddTodo() - adding a
todoItemfor the eventonKeyUp == Enter
The method
private void AddTodo()
{
if (!string.IsNullOrWhiteSpace(newTodo))
{
todos.Add(new TodoItem { Title = newTodo, Responsible = person});
newTodo = string.Empty;
}
}
Questions
- How can multiple form values (input, select) be bound to a method?
- Why is onkeyup not firing?
Source code of my Todo.razor gist

