# Events

The Telerik UI InlineAIPrompt for ASP.NET Core [exposes multiple events](https://www.telerik.com/aspnet-core-ui/documentation/api/kendo.mvc.ui.fluent/inlineaiprompteventbuilder) like `PromptRequest`, `PromptRequestCancel`, and more, that allow you to control the behavior of the UI component.

For a complete example on basic InlineAIPrompt events, refer to the [demo on using the events of the InlineAIPrompt](https://demos.telerik.com/aspnet-core/inline-aiprompt/events).

## Handling by Handler Name

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

```Razor HtmlHelper
    @(Html.Kendo().InlineAIPrompt()
        .Name("inlineaiprompt")
        .Events(ev => ev.PromptRequest("onPromptRequest"))
        ... //Additional configuration
    )
```

```Razor TagHelper
    @addTagHelper *, Kendo.Mvc

    <kendo-inlineaiprompt name="inlineaiprompt" on-prompt-request="onPromptRequest">
        
    </kendo-inlineaiprompt>
```

```JS scripts
    <script>
        function onPromptRequest(e){
            // Handle the InlineAIPrompt PromptRequest event that triggers when the Send button is clicked.
        }
    </script>
```

## Handling by Template Delegate

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

```Razor HtmlHelper
    @(Html.Kendo().InlineAIPrompt()
        .Name("inlineaiprompt")
        .Events(e => e.PromptRequest(@<text>
            function() {
                // Handle the InlineAIPrompt PromptRequest event inline.
            }
            </text>)
        )
        ... //Additional configuration
    )
```

```Razor TagHelper
    @addTagHelper *, Kendo.Mvc

    <kendo-inlineaiprompt name="inlineaiprompt" on-prompt-request="function() {
            // Handle the InlineAIPrompt PromptRequest event inline.
        }">
        
    </kendo-inlineaiprompt>
```

## Next Steps

* [Using the InlineAIPrompt Events (Demo)](https://demos.telerik.com/aspnet-core/inline-aiprompt/events)

## See Also

* [Using the API of the InlineAIPrompt for ASP.NET Core (Demo)](https://demos.telerik.com/aspnet-core/inlineaiprompt/api)

* [Client-Side API of the InlineAIPrompt](https://docs.telerik.com/kendo-ui/api/ui/inlineaiprompt)

* [Server-Side API of the InlineAIPrompt](https://www.telerik.com/aspnet-core-ui/documentation/api/inlineaiprompt)

* [Server-Side API of the InlineAIPrompt TagHelper](https://www.telerik.com/aspnet-core-ui/documentation/api/taghelpers/inlineaiprompt)
