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

Redirect to controller action when appointment clicked

Can you give me an example of how to setup the scheduler control to redirect to a specific controller action when an appointment is clicked. I need to pass the appointment information to the controller action.

Thanks,
~randy

P.S. Some detailed user guide information on the scheduler would really help. Just sayin...

1 Reply

SK Sarath Kumar P K Syncfusion Team March 18, 2015 12:07 PM UTC

Hi Randall,

Thanks for using Syncfusion products.

We have prepared a sample based on your requirement (“How to setup the scheduler control to redirect to a specific controller action when an appointment is clicked”) and it can be downloaded from the following location.

http://www.syncfusion.com/downloads/support/forum/118535/Localization-641396944.zip

In the above sample, we have used an ajax post within the “AppointmentClick” client side method and it will redirect to the controller action. And in the action method (controller page) we can get the appointment details in the argument (Ex: data).

Index.cshtml:

<code>

@(Html.EJ().Schedule("Schedule1")

.Width("100%")

.Height("600px")

.CurrentDate(new DateTime(2015, 3, 3))

.ScheduleClientSideEvents(eve => eve.Create("onCreate").AppointmentClick("onAppointmentClick")) //Need to mention the appointmentClick client side method

.CurrentView(CurrentView.Day)

.AppointmentSettings(fields => fields.Datasource(ds => ds.URL("Home/GetData").Adaptor("UrlAdaptor"))

.Id("Id")

.Subject("Subject")

.Description("Description")

.StartTime("StartTime")

.EndTime("EndTime")

.AllDay("AllDay")

.Recurrence("Recurrence")

.RecurrenceRule("RecurrenceRule"))

)

<script>

function onAppointmentClick(args) {

//ajax post to call the controller action

$.ajax({

type: "POST",

dataType: 'json',

data: JSON.stringify(args.appointment),

contentType: 'application/json; charset=utf-8',

url: "Home/appointmentClick"

});

}

</script>

</code>

HomeController.cs:

<code>

[HttpPost]

public JsonResult appointmentClick(Appointment data) {

return Json(data);

}

</code>

In controller action we can get the data which is passed from the appointmentClick client side method.

Please refer the below link for detailed user guide information about Schedule.

http://help.syncfusion.com/ug/js/default.htm#!documents/createyourschedulein.htm

Please let us know whether the provided sample helps you and need any further assistance on this.

Regards,

Sarath Kumar P K


Loader.
Live Chat Icon For mobile
Up arrow icon