We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Call controller and open custom modal view, when cell was clicked

Hello, I am working on a MVC 5 web application with Schedule for hotel reservations.

I need, when I click on a cell, if it is empty, call the controller (Create) and if it has an event, call the controller (Details), and then return a modal window, with the result of the view.

I also need to pass the data of the cell where it was clicked.

For example:

    function OnCellClick (args) {

         args.cancel = true;

         $ .ajax ({
             type: 'GET',
             url: '@ Url.Action ("Create", "Reservation")',
             contentType: "application / json; charset = utf-8",
             dataType: "json",
             data: { args: args },
             success: function () {
                 $ ('# modal_view_create'). show ();
             error: function () {
                 alert ('Error');


If it is not possible to call a controller, at least how can I open a modal window.

Thanks in advance.

1 Reply

KK Karthigeyan Krishnamurthi Syncfusion Team March 15, 2019 09:26 AM UTC

Hi Jorge, 
Thank you for contacting Syncfusion support. 
We have prepared the sample to show different editors on cell and event click. In the below sample, standard editor is prevented with in CellClick and EventClick events and custom editor is showed using openEditor public method and PopupOpen event. 
@Html.EJS().Schedule("schedule").SelectedDate(new DateTime(2018, 2, 15)).Width("100%").Height("550px").EventSettings(e => e.DataSource(ViewBag.appointments)).PopupOpen("onPopupOpen").EventClick("onEventClick").CellClick("onCellClick").Render() 
function onCellClick(args) { 
        args.cancel = true; 
        this.editorTemplate = "#CellEditorTemplate"; 
        this.openEditor(this.activeCellsData, 'Add'); 
    function onEventClick(args) { 
        args.cancel = true; 
        this.editorTemplate = "#EventEditorTemplate"; 
        this.openEditor(this.activeEventData.event, 'Save'); 
    function onPopupOpen(args) { 
        if (args.type === 'Editor') { 
            var statusElement = args.element.querySelector('#EventType'); 
            if (!ej.base.isNullOrUndefined(statusElement)) { 
                if (!statusElement.classList.contains('e-dropdownlist')) { 
                    var dropDownListObject = new ej.dropdowns.DropDownList({ 
                        placeholder: 'Select a status', value: statusElement.value, 
                        dataSource: ['New', 'Requested', 'Confirmed'] 
                    statusElement.setAttribute('name', 'EventType'); 
            var startElement = args.element.querySelector('#StartTime'); 
            if (!startElement.classList.contains('e-datetimepicker')) { 
                new ej.calendars.DateTimePicker({ value: new Date(startElement.value) || new Date() }, startElement); 
            var endElement = args.element.querySelector('#EndTime'); 
            if (!endElement.classList.contains('e-datetimepicker')) { 
                new ej.calendars.DateTimePicker({ value: new Date(endElement.value) || new Date() }, endElement); 

Live Chat Icon For mobile
Up arrow icon