New to Telerik UI for ASP.NET MVC? Start a free 30-day trial

Defines the fluent API for configuring the Kendo Chat for ASP.NET MVC events.

Definition

Constructors

Initializes a new instance of the Chat class.

C#
public ChatEventBuilder(IDictionary<string, object> events)
Parameters:eventsIDictionary<string, object>

The client events.

Methods

Fired when an action button is clicked inside an attachment template, or when a suggestedAction is clicked.

C#
[Obsolete("This option is obsolete since Q3 2025 and will be removed in future releases. Use the SuggestionClick and FileMenuAction events instead.")]
public ChatEventBuilder ActionClick(Func<object, object> handler)
Parameters:handlerFunc<object, object>

The handler code wrapped in a text tag.

Returns:

ChatEventBuilder

Example:
C#
@(Html.Kendo().Chat()
.Name("chat")
.Events(events =&gt; events.ActionClick(
@&lt;text&gt;
function(e) {
// event handling code
}
&lt;/text&gt;
))
)

Fired when an action button is clicked inside an attachment template or when a suggestedAction is clicked.

C#
[Obsolete("This option is obsolete since Q3 2025 and will be removed in future releases. Use the SuggestionClick and FileMenuAction events instead.")]
public ChatEventBuilder ActionClick(string handler)
Parameters:handlerstring

The name of the JavaScript function that will handle the actionClick event.

Returns:

ChatEventBuilder

Returns the current instance of ChatEventBuilder .

Example:
C#
@(Html.Kendo().Chat()
.Name("chat")
.Events(events =&gt; events.ActionClick("onActionClick"))
)

Defines the handler of the ContextMenuAction client-side event. Fired when a message context menu action is executed. This event allows you to handle custom message actions and respond to user interactions with message context menus.

C#
public ChatEventBuilder ContextMenuAction(string handler)
Parameters:handlerstring

The name of the JavaScript function that will handle the ContextMenuAction event.

Returns:

ChatEventBuilder

Defines the handler of the Download client-side event. Fired when a download action is triggered, either from the "Download All" button or from a file menu download action.

C#
public ChatEventBuilder Download(string handler)
Parameters:handlerstring

The name of the JavaScript function that will handle the Download event.

Returns:

ChatEventBuilder

Defines the handler of the ExecuteAction client-side event. Fired when the user clicks an action button in an attachment card. Use this event to handle custom actions defined in attachment data.

C#
public ChatEventBuilder ExecuteAction(string handler)
Parameters:handlerstring

The name of the JavaScript function that will handle the ExecuteAction event.

Returns:

ChatEventBuilder

Defines the handler of the FileMenuAction client-side event. Fired when a file context menu action is executed. This event allows you to handle custom file actions and respond to user interactions with file attachments.

C#
public ChatEventBuilder FileMenuAction(string handler)
Parameters:handlerstring

The name of the JavaScript function that will handle the FileMenuAction event.

Returns:

ChatEventBuilder

Defines the handler of the FileRemove client-side event. Fired when the user removes a file attachment.

C#
public ChatEventBuilder FileRemove(string handler)
Parameters:handlerstring

The name of the JavaScript function that will handle the FileRemove event.

Returns:

ChatEventBuilder

Defines the handler of the FileSelect client-side event. Fired when the user selects files using the file attachment button.

C#
public ChatEventBuilder FileSelect(string handler)
Parameters:handlerstring

The name of the JavaScript function that will handle the FileSelect event.

Returns:

ChatEventBuilder

Defines the handler of the Input client-side event. Fired when the user types in the message input field.

C#
public ChatEventBuilder Input(string handler)
Parameters:handlerstring

The name of the JavaScript function that will handle the Input event.

Returns:

ChatEventBuilder

Fired when a message is posted to the chat widget. This can be either through the message box, or an action button click.

C#
[Obsolete("This option is obsolete since Q3 2025 and will be removed in future releases. Use the SendMessage event instead.")]
public ChatEventBuilder Post(Func<object, object> handler)
Parameters:handlerFunc<object, object>

The handler code wrapped in a text tag.

Returns:

ChatEventBuilder

Example:
C#
@(Html.Kendo().Chat()
.Name("chat")
.Events(events =&gt; events.Post(
@&lt;text&gt;
function(e) {
// event handling code
}
&lt;/text&gt;
))
)

Fired when a message is posted to the chat widget. This can be either through the message box, or an action button click.

C#
[Obsolete("This option is obsolete since Q3 2025 and will be removed in future releases. Use the SendMessage event instead.")]
public ChatEventBuilder Post(string handler)
Parameters:handlerstring

The name of the JavaScript function that will handle the post event.

Returns:

ChatEventBuilder

Example:
C#
@(Html.Kendo().Chat()
.Name("chat")
.Events(events =&gt; events.Post("onPost"))
)

Defines the handler of the ReferencedMessageClick client-side event. Fired when the user clicks a pinned message banner or a reply reference.The event payload contains only { id } for both pinned-banner clicks and reply-reference clicks.In endless scrolling mode, the event fires before the Chat attempts to render and scroll to a referenced message that is outside the current batch.The event handler function context (available via the this keyword) will be set to the widget instance.

C#
public ChatEventBuilder ReferencedMessageClick(string handler)
Parameters:handlerstring

The name of the JavaScript function that will handle the ReferencedMessageClick event.

Returns:

ChatEventBuilder

Defines the handler of the ResendMessage client-side event. Fired when the user clicks the retry button on a failed message. Use this event to re-attempt message delivery.

C#
public ChatEventBuilder ResendMessage(string handler)
Parameters:handlerstring

The name of the JavaScript function that will handle the ResendMessage event.

Returns:

ChatEventBuilder

Defines the handler of the SendMessage client-side event. Fired when the user clicks the action button (send or stop). This is the primary event for handling message submission and stop generation requests.The postMessage method do not trigger this event.

C#
public ChatEventBuilder SendMessage(string handler)
Parameters:handlerstring

The name of the JavaScript function that will handle the SendMessage event.

Returns:

ChatEventBuilder

Defines the handler of the SuggestionClick client-side event. Fired when a user clicks a suggestion in the Chat. Global suggestions always trigger this event. Per-message suggestedActions trigger this event when suggestionsBehavior is set to "insert"; otherwise they flow through sendMessage.

C#
public ChatEventBuilder SuggestionClick(string handler)
Parameters:handlerstring

The name of the JavaScript function that will handle the SuggestionClick event.

Returns:

ChatEventBuilder

Defines the handler of the ToolbarAction client-side event. Fired when a toolbar action is executed on a message. This event allows you to handle custom toolbar actions and respond to user interactions with message controls.

C#
public ChatEventBuilder ToolbarAction(string handler)
Parameters:handlerstring

The name of the JavaScript function that will handle the ToolbarAction event.

Returns:

ChatEventBuilder

Fires when a button from the toolbar is clicked.

C#
[Obsolete("This option is obsolete since Q3 2025 and will be removed in future releases.")]
public ChatEventBuilder ToolClick(Func<object, object> handler)
Parameters:handlerFunc<object, object>

The handler code wrapped in a text tag.

Returns:

ChatEventBuilder

Returns the current instance of ChatEventBuilder .

Example:
C#
@(Html.Kendo().Chat()
.Name("chat")
.Toolbar(toolbar =&gt;
{
toolbar.Toggleable(true);
toolbar.Buttons(buttons =&gt;
{
buttons.Add().Name("sendimage").IconClass("k-icon k-i-image");
});
})
.Events(events =&gt; events.ToolClick(
@&lt;text&gt;
function(e) {
// event handling code
}
&lt;/text&gt;
))
)

Fires when a button from the toolbar is clicked.

C#
[Obsolete("This option is obsolete since Q3 2025 and will be removed in future releases.")]
public ChatEventBuilder ToolClick(string handler)
Parameters:handlerstring

The name of the JavaScript function that will handle the toolClick event.

Returns:

ChatEventBuilder

Returns the current instance of ChatEventBuilder .

Example:
C#
@(Html.Kendo().Chat()
.Name("chat")
.Toolbar(toolbar =&gt;
{
toolbar.Toggleable(true);
toolbar.Buttons(buttons =&gt;
{
buttons.Add().Name("sendimage").IconClass("k-icon k-i-image");
});
})
.Events(e =&gt;
{
e.ToolClick("onToolClick");
})
)

Fires when the user clears the chat message box which signals that the user has stopped typing. The event is also triggered when the user submits the currently typed in message.

C#
[Obsolete("This option is obsolete since Q3 2025 and will be removed in future releases. Use the Input event instead.")]
public ChatEventBuilder TypingEnd(Func<object, object> handler)
Parameters:handlerFunc<object, object>

The handler code wrapped in a text tag.

Returns:

ChatEventBuilder

Returns the current instance of ChatEventBuilder .

Example:
C#
@(Html.Kendo().Chat()
.Name("chat")
.Events(events =&gt; events.TypingEnd(
@&lt;text&gt;
function(e) {
// event handling code
}
&lt;/text&gt;
))
)

Fires when the user clears the chat message box which signals that the user has stopped typing. The event is also triggered when the user submits the currently typed in message.

C#
[Obsolete("This option is obsolete since Q3 2025 and will be removed in future releases. Use the Input event instead.")]
public ChatEventBuilder TypingEnd(string handler)
Parameters:handlerstring

The name of the JavaScript function that will handle the typingEnd event.

Returns:

ChatEventBuilder

Returns the current instance of ChatEventBuilder .

Example:
C#
@(Html.Kendo().Chat()
.Name("chat")
.Events(events =&gt; events.TypingEnd("onTypingEnd"))
)

Fires when the user starts typing in the Chat message box. The event is fired only once and not upon each keystroke.

C#
[Obsolete("This option is obsolete since Q3 2025 and will be removed in future releases. Use the Input event instead.")]
public ChatEventBuilder TypingStart(Func<object, object> handler)
Parameters:handlerFunc<object, object>

The handler code wrapped in a text tag.

Returns:

ChatEventBuilder

Returns the current instance of ChatEventBuilder .

Example:
C#
@(Html.Kendo().Chat()
.Name("chat")
.Events(events =&gt; events.TypingStart(
@&lt;text&gt;
function(e) {
// event handling code
}
&lt;/text&gt;
))
)

Fires when the user starts typing in the Chat message box. The event is fired only once and not upon each keystroke.

C#
[Obsolete("This option is obsolete since Q3 2025 and will be removed in future releases. Use the Input event instead.")]
public ChatEventBuilder TypingStart(string handler)
Parameters:handlerstring

The name of the JavaScript function that will handle the typingStart event.

Returns:

ChatEventBuilder

Returns the current instance of ChatEventBuilder .

Example:
C#
@(Html.Kendo().Chat()
.Name("chat")
.Events(events =&gt; events.TypingStart("onTypingStart"))
)

Defines the handler of the Unpin client-side event. Fired when a pinned message is unpinned. This event is triggered when a user clicks the close (X) button on a pinned message.

C#
public ChatEventBuilder Unpin(string handler)
Parameters:handlerstring

The name of the JavaScript function that will handle the Unpin event.

Returns:

ChatEventBuilder