Blazor DataGrid OnInsertRow event

When a new row is inserted into a DataGrid for data input, I would like to set focus to a particular textbox that exists in the edit template. I have the Javascript interface code in place that can accept the element id as a parameter, but I can't find an event that fires when the textbox is created. Does such an event exist?

                <RadzenGridColumn TItem="ParentObject" Property="ParentObjectProperty" Title="Column Title">
                    <EditTemplate Context="parentObject">
                        <RadzenTextBox @ref="@(Textboxes["ParentObjectProperty"])" @bind-Value="parentObject.ParentObjectProperty" />
                    </EditTemplate>
                </RadzenGridColumn>
protected RadzenGrid<ParentObject> ParentObjectGrid { get; set; }
protected Dictionary<string, RadzenTextBox> Textboxes = new Dictionary<string, RadzenTextBox>();

protected async void InsertRow()
{
       await ParentObjectGrid.InsertRow(new ParentObject());
       await BrowserService.SetElementFocus(Textboxes["ParentObjectProperty"].Element.Id);
}

When I run this, the RadzenTextBox "ParentObjectProperty" does not yet exist, so my Textboxes dictionary is empty.

Is there an event that fires after the OnInsertRow has completed and the edit template elements have been created?

Thanks,

Hey @JPalmgren,

Here is a possible approach:


Ah - never thought of adding the call right in the Edit Template. Thanks, @enchev!