Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to transfer data from background controller to foreground view by MVC in ASP.NET

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "how to transfer data from the background controller to the foreground view in ASP.NET". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to transfer data from the background controller to the foreground view in ASP.NET.

This paper gives an example of how MVC transfers data from the background controller to the foreground view in ASP.NET. Share it with you for your reference. The specific analysis is as follows:

Data storage model Model:

The copy code is as follows:

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 front desk receives and displays the data view View:

The copy code is as follows:

$(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

});

});

Background processing data controller Controller:

The copy code is as follows:

Public JsonResult CalendarData ()

{

Operation op = new Operation ()

List calendarData = op.GetData ()

Return Json (calendarData, JsonRequestBehavior.AllowGet)

}

Thank you for reading, the above is the content of "how does MVC transfer data from the background controller to the foreground view in ASP.NET". After the study of this article, I believe you have a deeper understanding of how MVC in ASP.NET transfers data from the background controller to the foreground view, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report