OnPost
The OnPost client-side event fires when a message is posted to the RadChat control. This can be either through the message box, or an action button click. Equal to the post event of the underlying Kendo UI Chat widget.
The event handler receives two parameters:
- The Chat instance firing the event.
- An object with the following methods:
-
get_from()
- this contains theid
,name
andiconUrl
set to the chat instance; -
get_sender()
- the Kendo UI Chat widget instance which fired the event; -
get_text()
- the text value that was posted; -
get_timestamp()
- the current time of posting the message; -
get_type()
- the type of the message. Can be eithermessage
ortyping
.
-
<telerik:RadChat runat="server" ID="RadChat1">
<ClientEvents OnPost="onPost" />
</telerik:RadChat>
<script type="text/javascript">
function onPost(sender, args) {
var chat = sender;
var text = args.get_text();
var username = get_from().name;
}
</script>