I have a Form widget on a cshtml file:
@(Html.Kendo().Form<EditEraViewModel>() .Name("formEditEra") .HtmlAttributes(new { @method = "post" }) .Orientation("horizontal") .Layout("grid") .ButtonsTemplateId("buttonsTemplate") .Grid(g => g.Cols(1).Gutter(20)) .FormData(Model.EraViewModel) .Validatable(v => { v.ValidateOnBlur(false); v.ValidationSummary(vs => vs.Enable(false)); }) .Items(items => { .... }); }) .Events(ev => ev.Submit("EditEra.OnTestSubmit"))
I'm adding the button as a template, like this:
<script id="buttonsTemplate" type="text/x-kendo-template"> <div class="myButtonsContainer"> @if (!isImpersonating) { @(Html.Kendo().Button() .Name(@Localizer["general.page.button.submit"].ToString()) .HtmlAttributes(new { @class = "k-button k-button-md k-rounded-md k-button-solid k-button-solid-primary k-form-submit" }) .Content(@Localizer["general.page.button.submit"].ToString()) .Events(ev => ev.Click("EditEra.onFormSubmit")) .ToClientTemplate()) } @(Html.Kendo().Button() .Name(@Localizer["general.page.button.cancel"].ToString()) .HtmlAttributes(new { @class = "k-button k-button-md k-rounded-md k-button-solid k-button-solid-primary k-form-cancel" }) .Content(@Localizer["general.page.button.cancel"].ToString()) .Events(ev => ev.Click("goToProviderInfo")) .ToClientTemplate() ) </div> </script>
When the submit button is clicked, the OnPost method on the cshtml.cs file is not being triggered. It looks like the form is never submitted.
The "EditEra.OnTestSubmit" function that is called on the Submit event is being called. But the for is not being submitted, and the onPost method on the .cs file is never being executed.
What do I need to do to make sure that the form is submitted when the submit button is clicked?
Thanks.
I do