ChatBuilder

Methods

AllowMessageCollapse(System.Boolean)

Enables or disables message collapsing functionality for expandable messages. When enabled, long messages can be collapsed to save screen space.

Parameters

value - System.Boolean

The value that configures the allowmessagecollapse.

FileActions(System.Action)

Defines the collection of actions that will be rendered in the context menu for file attachments. Each action represents an operation that users can perform on files (download, delete, preview, etc.).

Parameters

configurator - System.Action<ChatFileActionFactory>

The action that configures the fileactions.

AutoBind(System.Boolean)

Controls whether the Chat will automatically fetch data from the data source when initialized. When set to false, you must manually call the data source's fetch() method.

Parameters

value - System.Boolean

The value that configures the autobind.

AuthorId(System.String)

Specifies the unique identifier of the current user. If not set, a GUID will be generated automatically. This determines which messages are displayed as "own messages" (right-aligned) versus "other messages" (left-aligned).

Parameters

value - System.String

The value that configures the authorid.

AuthorIdField(System.String)

Specifies the field name in the data source from which the message author's unique identifier will be read.

Parameters

value - System.String

The value that configures the authoridfield.

AuthorImageAltTextField(System.String)

Specifies the field name in the data source from which the alt text for the author's avatar image will be read.

Parameters

value - System.String

The value that configures the authorimagealttextfield.

AuthorImageUrlField(System.String)

Specifies the field name in the data source from which the URL for the author's avatar image will be read.

Parameters

value - System.String

The value that configures the authorimageurlfield.

AuthorNameField(System.String)

Specifies the field name in the data source from which the author's display name will be read.

Parameters

value - System.String

The value that configures the authornamefield.

FileAttachment(System.Boolean)

Enables or disables file attachment functionality in the message input.

Parameters

value - System.Boolean

The value that configures the fileattachment.

FilesField(System.String)

Specifies the field name in the data source from which the array of files attached to a message will be read.

Parameters

value - System.String

The value that configures the filesfield.

Height(System.String)

Sets the height of the Chat component.

Parameters

value - System.String

The value that configures the height.

IdField(System.String)

Specifies the field name in the data source from which the unique identifier for each message will be read.

Parameters

value - System.String

The value that configures the idfield.

IsDeletedField(System.String)

Specifies the field name in the data source that indicates whether a message has been deleted.

Parameters

value - System.String

The value that configures the isdeletedfield.

IsPinnedField(System.String)

Specifies the field name in the data source that indicates whether a message is pinned.

Parameters

value - System.String

The value that configures the ispinnedfield.

IsTypingField(System.String)

Specifies the field name in the data source that indicates whether a message is currently being typed.

Parameters

value - System.String

The value that configures the istypingfield.

MessageActions(System.Action)

Defines the collection of actions that will be rendered in the context menu for messages. By default, the Chat includes four actions: Reply, Copy, Pin, and Delete. You can customize this list by providing your own actions or combining default actions with custom ones.Default actions: - { name: "reply", text: "Reply", icon: "undo" } - { name: "copy", text: "Copy", icon: "copy" } - { name: "pin", text: "Pin", icon: "pin" } - { name: "delete", text: "Delete", icon: "trash" }

Parameters

configurator - System.Action<ChatMessageActionFactory>

The action that configures the messageactions.

Messages(System.Action)

Allows localization of the strings that are used in the component.

Parameters

configurator - System.Action<ChatMessagesSettingsBuilder>

The action that configures the messages.

MessageTimeFormat(System.String)

The format string used to display message timestamps.

Parameters

value - System.String

The value that configures the messagetimeformat.

MessageToolbarActions(System.Action)

Defines the collection of actions that will be rendered in the message toolbar.

Parameters

configurator - System.Action<ChatMessageToolbarActionFactory>

The action that configures the messagetoolbaractions.

SkipSanitization(System.Boolean)

Controls whether HTML sanitization is skipped when rendering message content. When set to true, the Chat component will not automatically encode HTML entities in message text, allowing for rich HTML content to be displayed. This is useful when integrating with markdown parsers or when you need to display pre-formatted HTML content.Warning: Setting this to true can introduce security vulnerabilities if user input is not properly sanitized elsewhere in your application. Only use this option when you trust the content source or have implemented your own sanitization logic.

Parameters

value - System.Boolean

The value that configures the skipsanitization.

ReplyToIdField(System.String)

Specifies the field name in the data source that contains the ID of the message being replied to.

Parameters

value - System.String

The value that configures the replytoidfield.

SpeechToText(System.Boolean)

Enables or disables speech-to-text functionality in the message input.

Parameters

value - System.Boolean

The value that configures the speechtotext.

SuggestedActionsScrollable(System.Boolean)

Enables or disables scrollable behavior for suggested actions.

Parameters

value - System.Boolean

The value that configures the suggestedactionsscrollable.

Suggestions(System.Action)

Defines the collection of suggested messages that users can quickly select. These appear as clickable buttons below the message input area, allowing users to send common responses quickly.

Parameters

configurator - System.Action<ChatSuggestionFactory>

The action that configures the suggestions.

SuggestionsScrollable(System.Boolean)

Enables or disables scrollable behavior for message suggestions.

Parameters

value - System.Boolean

The value that configures the suggestionsscrollable.

TextField(System.String)

Specifies the field name in the data source from which the message text content will be read.

Parameters

value - System.String

The value that configures the textfield.

TimestampField(System.String)

Specifies the field name in the data source from which the message timestamp will be read.

Parameters

value - System.String

The value that configures the timestampfield.

Width(System.String)

Sets the width of the Chat component.

Parameters

value - System.String

The value that configures the width.

Dir(Kendo.Mvc.UI.TextDirection)

Specifies the text direction of the Chat.

Parameters

value - TextDirection

The value that configures the dir.

User(System.Action)

Configures the user information of the Chat.

Parameters

configurator - System.Action<ChatUserSettingsBuilder>

The configurator for the user setting.

RETURNS

Returns the current instance of ChatBuilder .

Toolbar(System.Action)

Configures the toolbar of the Chat.

Parameters

configurator - System.Action<ChatToolbarSettingsBuilder>

The configurator for the toolbar setting.

RETURNS

Returns the current instance of ChatBuilder .

BindTo(System.Collections.Generic.IEnumerable)

Binds the component to an IEnumerable collection.

Parameters

data - System.Collections.Generic.IEnumerable<ChatMessage>

The IEnumerable collection.

RETURNS

Returns the current ChatBuilder instance.

Example

Razor
 
                @(Html.Kendo().Chat()
                     .Name("chat")
                     .BindTo(new List<ChatMessage>
                     {
                         new ChatMessage { Text = "Text1" },
                         new ChatMessage { Text = "Text2" }
                     }))
             

DataSource(System.Action)

Sets the DataSource configuration of the Chat for remote data binding.

Parameters

configurator - System.Action<DataSourceBuilder>

The action that configures the DataSource.

RETURNS

Returns the current ChatBuilder instance.

Example

Razor
 
            @(Html.Kendo().Chat()
                .Name("chat")
                .DataSource(source =>
                {
                    source.Read(read =>
                    {
                        read.Action("GetChatMessages", "Home");
                    })
                })
            )
             

DataSource(System.String)

Sets the DataSource configuration of the Chat for remote data binding.

Parameters

dataSourceId - System.String

The dataSource id that configures the DataSource.

RETURNS

Returns the current ChatBuilder instance.

Example

Razor
 
            @(Html.Kendo().Chat()
                .Name("chat")
                .DataSource("myDataSource")
            )
             

MessageWidthMode(Kendo.Mvc.UI.MessageWidthMode)

Sets the messages width mode.

Parameters

mode - MessageWidthMode

RETURNS

Returns the current ChatBuilder instance.

Events(System.Action)

Configures the client-side events.

Parameters

configurator - System.Action<ChatEventBuilder>

The client events action.

Example

Razor
 
            @(Html.Kendo().Chat()
                        .Name("Chat")
                        .Events(events => events
                            .Input("onInput")
                        )
            )
             

HeaderItems(System.Action)

Defines the collection of items that will be rendered in the Chat header. Each item represents a component or content that appears in the header area above the message list. The items follow the same structure as AppBar items.

Parameters

configurator - System.Action<AppBarItemFactory>

The configurator for the header items setting.

RETURNS

Returns the current instance of ChatBuilder .

FilesTemplateId(System.String)

The template used to render file attachments in messages.

Parameters

templateId - System.String

The ID of the template element for FilesTemplate

RETURNS

Returns the current ChatBuilder instance.

FilesTemplateHandler(System.String)

The template used to render file attachments in messages.

Parameters

templateHandler - System.String

The handler that returs the template for FilesTemplate

RETURNS

Returns the current ChatBuilder instance.

FilesTemplate(Kendo.Mvc.UI.Fluent.TemplateBuilder)

The template used to render file attachments in messages.

Parameters

template - TemplateBuilder<TModel>

A Template component that configures the filestemplate.

RETURNS

Returns the current ChatBuilder instance.

MessageGroupTemplateId(System.String)

The template used to render message groups.

Parameters

templateId - System.String

The ID of the template element for MessageGroupTemplate

RETURNS

Returns the current ChatBuilder instance.

MessageGroupTemplateHandler(System.String)

The template used to render message groups.

Parameters

templateHandler - System.String

The handler that returs the template for MessageGroupTemplate

RETURNS

Returns the current ChatBuilder instance.

MessageGroupTemplate(Kendo.Mvc.UI.Fluent.TemplateBuilder)

The template used to render message groups.

Parameters

template - TemplateBuilder<TModel>

A Template component that configures the messagegrouptemplate.

RETURNS

Returns the current ChatBuilder instance.

MessageReferenceTemplateId(System.String)

The template used to render message references (replies and pinned messages).

Parameters

templateId - System.String

The ID of the template element for MessageReferenceTemplate

RETURNS

Returns the current ChatBuilder instance.

MessageReferenceTemplateHandler(System.String)

The template used to render message references (replies and pinned messages).

Parameters

templateHandler - System.String

The handler that returs the template for MessageReferenceTemplate

RETURNS

Returns the current ChatBuilder instance.

MessageReferenceTemplate(Kendo.Mvc.UI.Fluent.TemplateBuilder)

The template used to render message references (replies and pinned messages).

Parameters

template - TemplateBuilder<TModel>

A Template component that configures the messagereferencetemplate.

RETURNS

Returns the current ChatBuilder instance.

MessageTemplateId(System.String)

The template used to render individual messages.

Parameters

templateId - System.String

The ID of the template element for MessageTemplate

RETURNS

Returns the current ChatBuilder instance.

MessageTemplateHandler(System.String)

The template used to render individual messages.

Parameters

templateHandler - System.String

The handler that returs the template for MessageTemplate

RETURNS

Returns the current ChatBuilder instance.

MessageTemplate(Kendo.Mvc.UI.Fluent.TemplateBuilder)

The template used to render individual messages.

Parameters

template - TemplateBuilder<TModel>

A Template component that configures the messagetemplate.

RETURNS

Returns the current ChatBuilder instance.

SuggestedActionsTemplateId(System.String)

The template used to render suggested actions.

Parameters

templateId - System.String

The ID of the template element for SuggestedActionsTemplate

RETURNS

Returns the current ChatBuilder instance.

SuggestedActionsTemplateHandler(System.String)

The template used to render suggested actions.

Parameters

templateHandler - System.String

The handler that returs the template for SuggestedActionsTemplate

RETURNS

Returns the current ChatBuilder instance.

SuggestedActionsTemplate(Kendo.Mvc.UI.Fluent.TemplateBuilder)

The template used to render suggested actions.

Parameters

template - TemplateBuilder<TModel>

A Template component that configures the suggestedactionstemplate.

RETURNS

Returns the current ChatBuilder instance.

SuggestionsTemplateId(System.String)

The template used to render message suggestions.

Parameters

templateId - System.String

The ID of the template element for SuggestionsTemplate

RETURNS

Returns the current ChatBuilder instance.

SuggestionsTemplateHandler(System.String)

The template used to render message suggestions.

Parameters

templateHandler - System.String

The handler that returs the template for SuggestionsTemplate

RETURNS

Returns the current ChatBuilder instance.

SuggestionsTemplate(Kendo.Mvc.UI.Fluent.TemplateBuilder)

The template used to render message suggestions.

Parameters

template - TemplateBuilder<TModel>

A Template component that configures the suggestionstemplate.

RETURNS

Returns the current ChatBuilder instance.

TimestampTemplateId(System.String)

The template used to render timestamp elements that separate message groups by date. When set to null, the default timestamp logic is used which displays relative dates like "Today", "Yesterday", "Last Wednesday", or absolute dates for older messages.The template function receives an object with date (parsed Date object) and message (current message object) properties and should return the complete HTML structure for the timestamp element.Returning null or an empty string will hide the time breaks from the chat.

Parameters

templateId - System.String

The ID of the template element for TimestampTemplate

RETURNS

Returns the current ChatBuilder instance.

TimestampTemplateHandler(System.String)

The template used to render timestamp elements that separate message groups by date. When set to null, the default timestamp logic is used which displays relative dates like "Today", "Yesterday", "Last Wednesday", or absolute dates for older messages.The template function receives an object with date (parsed Date object) and message (current message object) properties and should return the complete HTML structure for the timestamp element.Returning null or an empty string will hide the time breaks from the chat.

Parameters

templateHandler - System.String

The handler that returs the template for TimestampTemplate

RETURNS

Returns the current ChatBuilder instance.

TimestampTemplate(Kendo.Mvc.UI.Fluent.TemplateBuilder)

The template used to render timestamp elements that separate message groups by date. When set to null, the default timestamp logic is used which displays relative dates like "Today", "Yesterday", "Last Wednesday", or absolute dates for older messages.The template function receives an object with date (parsed Date object) and message (current message object) properties and should return the complete HTML structure for the timestamp element.Returning null or an empty string will hide the time breaks from the chat.

Parameters

template - TemplateBuilder<TModel>

A Template component that configures the timestamptemplate.

RETURNS

Returns the current ChatBuilder instance.

ToComponent()

Returns the internal view component.

Name(System.String)

Sets the name of the component.

Parameters

componentName - System.String

The name of the component.

Example

Razor
 
            @(Html.Kendo().Grid<OrderViewModel>()
               .Name("grid")
               .Columns(columns =>
               {
                   columns.Bound(p => p.OrderID).Filterable(false);
                   columns.Bound(p => p.Freight);
               })
               .DataSource(dataSource => dataSource
                   .Ajax()
                   .PageSize(20)
                   .Read(read => read.Action("Orders_Read", "Grid"))
               )
            )
             

Deferred(System.Boolean)

Suppress initialization script rendering. Note that this options should be used in conjunction with

Parameters

deferred - System.Boolean

ModelMetadata(System.Web.Mvc.ModelMetadata)

Uses the Metadata of the Model.

Parameters

modelMetadata - System.Web.Mvc.ModelMetadata

The metadata set for the Model

HtmlAttributes(System.Object)

Sets the HTML attributes.

Parameters

attributes - System.Object

The HTML attributes.

HtmlAttributes(System.Collections.Generic.IDictionary)

Parameters

attributes - System.Collections.Generic.IDictionary<String,Object>

AsModule(System.Boolean)

Specifies whether the initialization script of the component will be rendered as a JavaScript module.

Parameters

value - System.Boolean

Render()

Renders the component.

Example

Razor
 
            @(@Page Inherits="System.Web.Mvc.ViewPage<IEnumerable<Product>>" )
            @( Html.Kendo().Grid(Model)
                .Name("grid")
                .DetailTemplate(product => {
                    )
                       Product Details:
                       <div>Product Name: @( product.ProductName )</div>
                       <div>Units In Stock: @( product.UnitsInStock )</div>
                    @(
                })
                .Render();
            )
             

ScriptAttributes(System.Object,System.Boolean)

Sets the JavaScript attributes to the initialization script.

Parameters

attributes - System.Object

The JavaScript attributes.

overrideAttributes - System.Boolean

Argument which determines whether attributes should be overriden.

ScriptAttributes(System.Collections.Generic.IDictionary,System.Boolean)

Sets the JavaScript attributes to the initialization script.

Parameters

attributes - System.Collections.Generic.IDictionary<String,Object>

The JavaScript attributes.

overrideAttributes - System.Boolean

Argument which determines whether attributes should be overriden.

ToHtmlString()

ToClientTemplate()

In this article
MethodsAllowMessageCollapse(System.Boolean)FileActions(System.Action)AutoBind(System.Boolean)AuthorId(System.String)AuthorIdField(System.String)AuthorImageAltTextField(System.String)AuthorImageUrlField(System.String)AuthorNameField(System.String)FileAttachment(System.Boolean)FilesField(System.String)Height(System.String)IdField(System.String)IsDeletedField(System.String)IsPinnedField(System.String)IsTypingField(System.String)MessageActions(System.Action)Messages(System.Action)MessageTimeFormat(System.String)MessageToolbarActions(System.Action)SkipSanitization(System.Boolean)ReplyToIdField(System.String)SpeechToText(System.Boolean)SuggestedActionsScrollable(System.Boolean)Suggestions(System.Action)SuggestionsScrollable(System.Boolean)TextField(System.String)TimestampField(System.String)Width(System.String)Dir(Kendo.Mvc.UI.TextDirection)User(System.Action)Toolbar(System.Action)BindTo(System.Collections.Generic.IEnumerable)DataSource(System.Action)DataSource(System.String)MessageWidthMode(Kendo.Mvc.UI.MessageWidthMode)Events(System.Action)HeaderItems(System.Action)FilesTemplateId(System.String)FilesTemplateHandler(System.String)FilesTemplate(Kendo.Mvc.UI.Fluent.TemplateBuilder)MessageGroupTemplateId(System.String)MessageGroupTemplateHandler(System.String)MessageGroupTemplate(Kendo.Mvc.UI.Fluent.TemplateBuilder)MessageReferenceTemplateId(System.String)MessageReferenceTemplateHandler(System.String)MessageReferenceTemplate(Kendo.Mvc.UI.Fluent.TemplateBuilder)MessageTemplateId(System.String)MessageTemplateHandler(System.String)MessageTemplate(Kendo.Mvc.UI.Fluent.TemplateBuilder)SuggestedActionsTemplateId(System.String)SuggestedActionsTemplateHandler(System.String)SuggestedActionsTemplate(Kendo.Mvc.UI.Fluent.TemplateBuilder)SuggestionsTemplateId(System.String)SuggestionsTemplateHandler(System.String)SuggestionsTemplate(Kendo.Mvc.UI.Fluent.TemplateBuilder)TimestampTemplateId(System.String)TimestampTemplateHandler(System.String)TimestampTemplate(Kendo.Mvc.UI.Fluent.TemplateBuilder)ToComponent()Name(System.String)Deferred(System.Boolean)ModelMetadata(System.Web.Mvc.ModelMetadata)HtmlAttributes(System.Object)HtmlAttributes(System.Collections.Generic.IDictionary)AsModule(System.Boolean)Render()ScriptAttributes(System.Object,System.Boolean)ScriptAttributes(System.Collections.Generic.IDictionary,System.Boolean)ToHtmlString()ToClientTemplate()
Not finding the help you need?
Contact Support