This example describes how MVC passes data from the background controller to the foreground view in ASP. Share to everyone for your reference. The specific analysis is as follows:
Data storage Model:
public class Calendarevent{public string ID {get; set;} Public DateTime start {get; set;} Public DateTime end {get; set;} public string BackgroundColor {get; set;} public string Title {get; set;} public string AllDay {get; set;}}
The foreground receives the display view of the data:
<script type= "Text/javascript" >$ (function () { //calendar handle data as follows: var events = []; $.ajax ({url: "/deploymenttask/calendardata", success:function (data) { events = data;}, Async:false }); $ ("#calendar"). Fullcalendar ({header: {left : ' Prev,next today ', Center: ' title ', //right: ' Month, Agendaweek,agendaday ' right : ' Month '}, Selectable:true, Weekmode: ' Variable ',//fixed,variable,liquid events: Events, defaulteventminutes:1440 //default event length is one day }); </script>
Background processing data controller controllers:
Public Jsonresult CalendarData () { operation op = new operation (); List<calendarevent> calendardata = Op. GetData (); Return Json (CalendarData, jsonrequestbehavior.allowget);}
I hope this article is helpful to everyone's ASP.