I want to access the to Access the Inline Edit Object from the Data Grid. I want to validate the field values with an external API: email address and mobile number.
Would something like this work?
<EditTemplate Context="order">
<RadzenTextBox @bind-Value="order.Email" Style="width:100%; display: block" Name="Email" Change="@(args => ValidateEmail(order))"/>
<RadzenRequiredValidator Text="Email is required" Component="Email" Popup="true" />
</EditTemplate>
async Task ValidateEmail(Order order)
{
await ValidateEmailAPI(order.Email);
}
korchev
February 21, 2022, 6:20am
2
Can you elaborate? What do you expect to happen?
create datagrid with inline editing
click on edit icon
when users edits column/field and loses focus, then run a function on field and/or on object being edited.
in the code below, after user edits ShipName (while inline), run a function
<RadzenDataGridColumn TItem="Order" Property="ShipName" Title="Ship Name">
<EditTemplate Context="order">
<RadzenTextBox @bind-Value="order.ShipName" Style="width:100%; display: block" Name="ShipName" *Change?=@Fucntion*/>
<RadzenRequiredValidator Text="ShipName is required" Component="ShipName" Popup="true" />
</EditTemplate>
</RadzenDataGridColumn>
<RadzenDataGridColumn TItem="Order" Context="sampleBlazorModelsSampleOrder" Filterable="false" Sortable="false"
TextAlign="TextAlign.Center" Width="120px">
<Template Context="order">
<RadzenButton Icon="edit" ButtonStyle="ButtonStyle.Light" Class="m-1" Click="@(args => EditRow(order))"
@onclick:stopPropagation="true">
</RadzenButton>
</Template>
<EditTemplate Context="order">
<RadzenButton Icon="check" ButtonStyle="ButtonStyle.Primary" Class="m-1" Click="@((args) => SaveRow(order))">
</RadzenButton>
<RadzenButton Icon="close" ButtonStyle="ButtonStyle.Light" Class="m-1" Click="@((args) => CancelEdit(order))">
</RadzenButton>
</EditTemplate>
</RadzenDataGridColumn>
korchev
February 21, 2022, 7:27pm
4
Yes, the change event would fire and allow you to execute some code.