New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial
Server-side Programming
You can configure the settings of RadChat and create its elements on the code-behind via the Server-Side API of this customizable ASP.NET Chat control.
Example 1 shows a possible application of the Server-Side API of the chat. The code in the example configures some settings of the chat, of its User and Messages settings, then assigns the event handlers of the client-side events.
Example 1: Configuring a RadChat on the server-side.
C#
protected void Page_Load(object sender, EventArgs e)
{
RadChat chat = new RadChat();
chat.ID = "RadChat1";
chat.CssClass = "my-chat";
chat.MessagesSettings.Placeholder = "Hey ya, write here";
chat.UserSettings.Name = "John";
chat.UserSettings.IconUrl = "John";
chat.ClientEvents.OnActionClick = "оnActionClick";
chat.ClientEvents.OnInitialize = "onInitialize";
chat.ClientEvents.OnLoad = "onLoad";
chat.ClientEvents.OnPost = "onPost";
chat.ClientEvents.OnSendMessage = "onSendMessage";
chat.ClientEvents.OnTypingEnd = "onTypingEnd";
chat.ClientEvents.OnTypingStart = "onTypingStart";
Form.Controls.Add(chat);
}
JavaScript
function onTypingStart(sender, args) {
}
function onTypingEnd(sender, args) {
}
function onSendMessage(sender, args) {
}
function onPost(sender, args) {
}
function onLoad(sender) {
}
function оnActionClick(sender, args) {
}
function onInitialize(sender) {
}