I am trying to follow the Inline edit tutorial with making a DataGrid but I can't seem to get the RowCreate/RowUpdate event handlers to fire. I am following this: Datagrid-Inline-Edit
<RadzenGrid Count="@count" Data="@employees" @ref="employeesGrid" AllowSorting="true" AllowFiltering="true" AllowPaging="true" PageSize="20" TItem="Employee" ColumnWidth="overflow: auto;"
EditMode="DataGridEditMode.Single" RowCreate="@OnCreateRow" RowUpdate="@OnUpdateRow" >
<Columns>
<RadzenGridColumn TItem="Employee" Property="EmployeeID" Title="Employee ID">
<EditTemplate Context="employee">
<RadzenTextBox @bind-Value="employee.EmployeeID" Style="width:100%; display: block" Name="Employee ID" />
<RadzenRequiredValidator Text="Employee ID is required" Component="EmployeeID" Popup="true" />
</EditTemplate>
</RadzenGridColumn>
<RadzenGridColumn TItem="Employee" Property="FirstName" Title="First Name">
<EditTemplate Context="employee">
<RadzenTextBox @bind-Value="employee.FirstName" Style="width:100%; display: block" Name="First Name" />
<RadzenRequiredValidator Text="First Name is required" Component="FirstName" Popup="true" />
</EditTemplate>
</RadzenGridColumn>
<RadzenGridColumn TItem="Employee" Property="LastName" Title="Last Name">
<EditTemplate Context="employee">
<RadzenTextBox @bind-Value="employee.LastName" Style="width:100%; display: block" Name="Last Name" />
<RadzenRequiredValidator Text="Last Name is required" Component="LastName" Popup="true" />
</EditTemplate>
</RadzenGridColumn>
<RadzenGridColumn TItem="Employee" Context="employee" Bubble="false" Filterable="false" Sortable="false" TextAlign="TextAlign.Center" Width="100px">
<Template Context="employee">
<RadzenButton Icon="edit" Size="ButtonSize.Small" Click="@(args => EditRow(employee))">
</RadzenButton>
</Template>
<EditTemplate Context="employee">
<RadzenButton Icon="save" Size="ButtonSize.Small" Click="@((args) => SaveRow(employee))">
</RadzenButton>
<RadzenButton Icon="cancel" Size="ButtonSize.Small" ButtonStyle="ButtonStyle.Secondary" Click="@((args) => CancelEdit(employee))">
</RadzenButton>
</EditTemplate>
</RadzenGridColumn>
</Columns>
</RadzenGrid>
And here is my backend code
void EditRow(Employee employee)
{
employee = SetStatus(employee);
employee = ValidateDateTimes(employee);
employeesGrid.EditRow(employee);
}
void OnUpdateRow(Employee employee)
{
if (!ValidateUniqueEmployeeID(employee))
{
ShowToast(MatToastType.Warning, "Error", "An employee already exists with this Employee ID.");
return;
}
try
{
employeeRepo.UpdateEmployee(employee);
}
catch (Exception ex)
{
ShowToast(MatToastType.Danger, "Error", string.Format("Failed saving employee. {0}", ex.Message.ToString()));
}
ShowToast(MatToastType.Success, "Success", "Employee Saved");
}
void SaveRow(Employee employee)
{
employee = SetStatus(employee);
employee = ValidateDateTimes(employee);
employeesGrid.UpdateRow(employee);
}
void CancelEdit(Employee employee)
{
employeesGrid.CancelEditRow(employee);
}
void InsertRow()
{
employeesGrid.InsertRow(new Employee(appSettings));
}
void OnCreateRow(Employee employee)
{
if (!ValidateUniqueEmployeeID(employee))
{
ShowToast(MatToastType.Warning, "Error", "An employee already exists with this Employee ID");
return;
}
try
{
employeeRepo.InsertEmployee(employee);
}
catch (Exception ex)
{
ShowToast(MatToastType.Danger, "Error", string.Format("Failed inserting employee. {0}", ex.Message.ToString()));
}
ShowToast(MatToastType.Success, "Success", "Employee Saved");
}
I am never able to get the OnCreateRow() or the OnUpdateRow functions to fire. Is there something I am missing?