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
close icon

Redirect to controller action with Event Id on the click event of the appointment.

I am populating a scheule with meetings that are added via a seperate windows application, I will not be enabling the any CRUD options in the schedule.

I wish to redirect to a controller action when the appointment is clicked, and only require the Id of the appointment for further use. I have read a few other articles and have tried using them (see code below) however as i only need the event Id i was hoping for a simpler way to pass the Id only (maybe something like --

window.location.rel='nofollow' href = "@Url.Action("OrderPaper", "DocumentProduction")?eventID=" + event.BookingID;


Thanks


View:

<div>

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

.Width("100%")

.Height("525px")                              

.ReadOnly(true)

.ScheduleClientSideEvents(eve => eve.Create("onCreate")

.AppointmentClick("onAppointmentClick")

.CellClick("onCellClick")

.AppointmentWindowOpen("onAppointmentWindowOpen"))

.AppointmentSettings(fields => fields.Datasource((IEnumerable<object>)ViewBag.dataSource)

.Id("Id")

.Subject("Subject")

.StartTime("StartTime")

.EndTime("EndTime")

.Description("Description")

.AllDay("AllDay")

.Recurrence("Recurrence")

.RecurrenceRule("RecurrenceRule"))

.Render();

} 

</div>


<script language="javascript" type="text/javascript">

 function onCellClick(args) {

 args.cancel = true;
}


 function onAppointmentWindowOpen(args) {

 args.cancel = true;
}


function onCreate(args) {


}


function onAppointmentClick(args) {

//ajax post to call the controller action

$.ajax({

 type: "POST",
 data: JSON.stringify(args.appointment),
 contentType: 'application/json; charset=utf-8',

//url: "DocumentProduction/OrderPaper",
 url: "@(Url.Action("OrderPaper", "DocumentProduction"))"

});


Controller:

[HttpPost]
public JsonResult OrderPaper(Appointment data)
{

 return Json(data);
}














}


</script>



1 Reply

SE Sellakumar Syncfusion Team January 13, 2017 03:15 PM UTC

Hi Keith, 
  
Thank you for contacting Syncfusion support. 
  
We have prepared the sample to meet your requirement based on the given code example, which can be download from the below location. 
 
  
Kindly revert us, if you need any further assistance. 
  
Regards, 
Sellakumar K

Loader.
Live Chat Icon For mobile
Up arrow icon