Asp. NET how MVC passes data from the background controller to the foreground view

Source: Internet
Author: User
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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.