I've got a TelerikGrid inside a Blazor EditForm component (abridged code):
<
EditForm
Model
=
"@_billOfLadingVM"
OnValidSubmit
=
"@HandleValidSubmit"
>
other bound components here
<
TelerikGrid
Data=@_billOfLadingVM.BillOfLadingContainers
EditMode
=
"incell"
Pageable
=
"true"
>
<
TelerikGridEvents
>
<
EventsManager
OnUpdate
=
"@UpdateHandler"
></
EventsManager
>
</
TelerikGridEvents
>
<
TelerikGridToolBar
>
<
TelerikGridCommandButton
Command
=
"Create"
Icon
=
"add"
>Add Container</
TelerikGridCommandButton
>
</
TelerikGridToolBar
>
<
TelerikGridColumns
>
@*<
TelerikGridColumn
Field=@nameof(HSCodeModel.HSCodeId)
Title
=
"ID"
Editable
=
"false"
/>*@
<
TelerikGridColumn
Field=@nameof(BillOfLadingContainerModel.ContainerCode)
Title
=
"Container Code"
/>
<
TelerikGridColumn
Field=@nameof(BillOfLadingContainerModel.ContainerSizeId)
Title
=
"Container Size"
/>
<
TelerikGridColumn
Field=@nameof(BillOfLadingContainerModel.IsLCL)
Title
=
"LCL"
/>
<
TelerikGridCommandColumn
>
<
TelerikGridCommandButton
Command
=
"Update"
Icon
=
"save"
ShowInEdit
=
"true"
>Update</
TelerikGridCommandButton
>
<
TelerikGridCommandButton
Command
=
"Edit"
Icon
=
"edit"
>Edit</
TelerikGridCommandButton
>
<
TelerikGridCommandButton
Command
=
"Delete"
Icon
=
"delete"
>Delete</
TelerikGridCommandButton
>
<
TelerikGridCommandButton
Command
=
"Cancel"
Icon
=
"cancel"
ShowInEdit
=
"true"
>Cancel</
TelerikGridCommandButton
>
</
TelerikGridCommandColumn
>
</
TelerikGridColumns
>
</
TelerikGrid
>
</
EditForm
>
When I press the Create command button (i.e. add new row in grid) in the grid's toolbar it seems like it causes the form to be submitted as the OnValidSubmit method is called. Is that the expected behaviour and is there any way to stop that happening?
My grid is updating child data of my `_billOfLadingVM` model class, so I don't want the grid to submit the whole form as the user may still have other data to enter in the other components.
The obvious solution is to move the grid outside of edit form component tags, but that's tricky to do with this particular form's layout.