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

Custom Templates

The RadChat control supports the definition of custom templates for the rich cards to fit any custom payload that is returned by the service.

The following example demonstrates how to implement a simple Kendo UI Template and to register it for the RadChat.

Figure 1: A Chat with a rich card that uses Kendo UI Templates.

chat with custom template

<telerik:RadChat runat="server" ID="RadChat1">
  <ClientEvents OnLoad="renderSuggestedActions" />
<script id="quote-template" type="text/x-kendo-template">
  <div class="#=styles.card# #=styles.cardRich#">
    <div class="#=styles.cardBody#">
        <strong>Car model:</strong>
        <strong>Car cost:</strong>
        <strong>Start date:</strong>
function renderCustomTemplate(sender) {
    // register template
    var QUOTE_CARD_TEMPLATE = kendo.template($('#quote-template').html());"quote", QUOTE_CARD_TEMPLATE);

    var chat = sender;
        attachments: [{
            contentType: "quote",
            content: {
                "premium": 200.0,
                "coverage": "Full coverage",
                "make": "Opel",
                "model": "Astra",
                "worth": "4000",
                "startDate": "2018-10-10"
        attachmentLayout: "carousel"
    }, chat.get_user());

See Also

In this article
Not finding the help you need? Improve this article