This is a migrated thread and some comments may be shown as answers.

Add button to notification

2 Answers 192 Views
Notification
This is a migrated thread and some comments may be shown as answers.
Phil
Top achievements
Rank 1
Phil asked on 28 Feb 2021, 10:21 PM
I'm using a custom client template on a Kendo UI Notification control. How can I add a button in the notification and respond to it in a javascript function?

2 Answers, 1 is accepted

Sort by
0
Accepted
Petar
Telerik team
answered on 03 Mar 2021, 11:08 AM

Hi Phil,

You can add a button to the Notification component using a custom template. Here is a Dojo example demonstrating how the targeted functionality can be implemented. The two templates used in the linked example are defined as follows:

template: "<div class='myWarning'>Warning: #= myMessage # <button onclick='notificationButtonClick()'>Click me</button></div>"
template: "<div class='myAlert'>System alert generated at #= time # : #= myMessage #<button onclick='notificationButtonClick()'>Click me</button></div>"

You can modify the code in yellow the same way as it is a regular HTML button. You can add custom classes to style the button or edit its text. 

I can see that you are working with UI for ASP.NET MVC. The demonstrated approach uses Kendo UI for jQuery but the template definition can be directly used in the UI for ASP.NET MVC Notification component. You may also find useful this demo example

Let me know if you have questions about the provided solution or if you need further assistance with the current ticket. 

Regards,
Petar
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Phil
Top achievements
Rank 1
answered on 03 Mar 2021, 08:16 PM
Perfect, thank you!
Tags
Notification
Asked by
Phil
Top achievements
Rank 1
Answers by
Petar
Telerik team
Phil
Top achievements
Rank 1
Share this question
or