Search code examples
jquerykendo-uikendo-window

How to create a custom confirm dialog in Kendo htmlhelper or Jquery


I'd like to create a custom confirm dialog containing Kendo DropDownLists and yes no buttons. It is done either in Kendo HtmlHelper like Kendo window or Jquery. The code should be like

reply = confirm("...");

if (reply == false)
{
    ...
}
else
    ...

When dialog is open, program should stay where dialog is opened (in this case, reply=confirm("...")) and wait for yes no answer. I tried Kendo window, but the problem is that after window is open, program will execute the next code and won't stay where it is opened.

I need help on this. Thanks.


Solution

  • In JavaScript, you generally have two options to tackle your problem. One is to create a callback function that does what you want to do and bind it to an event (e.g. click on a button), or you use a promise (similar but can be more flexible and easier to read; in your case you might want to use .done() and .fail()).

    I suggest reading up on the jQuery implementations of both. You could also take a look at this, which implements what you want (ExtYesNoDialog). Not sure if it works with a current version of Kendo UI though.