在 Kendo-UI Wizard ASP.NET Core 中,如何在单击时从服务器获取数据?

In Kendo-UI Wizard ASP.NET Core, How do I get data from the server on click?

如何提交 async/ajax 对我的剃刀页面方法的调用或在向导的步骤中进行自定义验证?

例如:我想根据之前输入的内容在每个步骤中填充数据。我查看了示例,但它们似乎没有显示此类用例。

来自documentation samples,显示了事件,但不清楚如何将步骤的特定完成(单击下一步)绑定到特定事件函数(以标签助手格式)。

.Events(events =>
        {
            events.Activate("onActivate");
            events.Error("onError");
            events.Done("onDone");
            events.Select("onSelect");
            events.Reset("onReset");
            events.ContentLoad("onContentLoad");
            events.FormValidateFailed("onFormValidateFailed");
        })

使用标签助手并尝试弄清楚如何绑定到步骤的事件时的屏幕截图:

事件与向导的步骤无关 - 它们处于向导级别:

    <kendo-wizard name="wizard" on-activate="onActivate" on-select="onSelect">
        <wizard-steps>
            <wizard-step title="Initial step">
                <wizard-step-content>
                    <h1>Initial step content</h1>
                </wizard-step-content>
            </wizard-step>
            <wizard-step title="Second step">
                <wizard-step-content>
                    <h1>Second step content</h1>
                </wizard-step-content>
            </wizard-step>
            <wizard-step title="Final step">
                <wizard-step-content>
                    <h1>Final step content</h1>
                </wizard-step-content>
            </wizard-step>
        </wizard-steps>
    </kendo-wizard>

    <script>
        function onActivate(e) {
            console.log("Activated: " + e.step.options.label);

           switch (e.step.options.label) {
             case 'step 1':
               //do what you need to here
               break;
             }
             case 'step 2':
               //do step 2 stuff here
               $.ajax({ whatever });
               break;
             default:
           }
        }

        function onSelect(e) {
            console.log("Selected: " + e.step.options.label);
        }

然后,在事件处理函数中 - 您可以根据触发事件的步骤来确定要执行的操作 - 使用 e.step.options.label(或那里的其他属性)。从位于 https://demos.telerik.com/aspnet-core/wizard/events 的示例中,他们输出触发每个事件的步骤的标题。