New to Telerik UI for ASP.NET Core? Download free 30-day trial

Events

The Telerik UI AIPrompt for ASP.NET Core exposes multiple events like CommandExecute, PromptRequest, and more, that allow you to control the behavior of the UI component.

For a complete example on basic AIPrompt events, refer to the demo on using the events of the AIPrompt.

Handling by Handler Name

The following example demonstrates how to subscribe to events by a handler name.

    @(Html.Kendo().AIPrompt()
        .Name("aiprompt")
        .Events(ev => ev.PromptRequest("onPromptRequest"))
        ... //Additional configuration
    )
    @addTagHelper *, Kendo.Mvc

    <kendo-aiprompt name="aiprompt" on-prompt-request="onPromptRequest">
        <!-- Additional configuration -->
    </kendo-aiprompt>
    <script>
        function onPromptRequest(e){
            // Handle the AIPrompt PromptRequest event that triggers when the prompt view 'Generate output' button is clicked.
        }
    </script>

Handling by Template Delegate

The following example demonstrates how to subscribe to events by a template delegate.

    @(Html.Kendo().AIPrompt()
        .Name("aiprompt")
        .Events(e => e.PromptRequest(@<text>
            function() {
                // Handle the AIPrompt PromptRequest event inline.
            }
            </text>)
        )
        ... //Additional configuration
    )
    @addTagHelper *, Kendo.Mvc

    <kendo-aiprompt name="aiprompt" on-prompt-request="function() {
            // Handle the AIPrompt PromptRequest event inline.
        }">
        <!-- Additional configuration -->
    </kendo-aiprompt>

Next Steps

See Also

In this article