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
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='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/.