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

How to clear RadChat Messages

Environment

Product Version all
Product RadChat for ASP.NET AJAX

Description

Learn how to clear the messages inside RadChat.

Solution

You can clear the content of the chat, you can utilize jQuery and get access to the element that holds the messages and clear the messages.

<telerik:RadButton runat="server" ID="RadButton1" Text="Clear Chat Screen" AutoPostBack="false" OnClientClicked="clearChatScreen" />

<script>
    function clearChatScreen(sender, args) {
        $('.RadChat .t-message-list-content div').remove();
    }
</script>

For more information on available Client-Side APIs you can check out the RadChat documentation at RadChat Object. Since this component is a wrapper for the Kendo Chat widget, some APIs can only be accessed for the underlying kendo Widget. For a full list of API configurations visit the kendo.ui.Chat documentation.

In this article