将FullCalendar(jquery)转换为asp.net(ashx)

时间:2013-07-19 08:14:55

标签: javascript asp.net .net serialization javascriptserializer

/////////////大师////////////////

$(document).ready(function() {

        var date = new Date();
        var d = date.getDate();
        var m = date.getMonth();
        var y = date.getFullYear();

        $('#calendar').fullCalendar({
            header: {
                left: 'prev,next today',
                center: 'title',
                right: 'month,agendaWeek,agendaDay'
            },
        editable: true,

        events: [
                {
                    id: 1,
                    title: moo,
                    start: new Date(2013, m, 1)
                }, 

////////////修改//////////////

<script>

        $(document).ready(function () {

            var date = new Date();
            var d = date.getDate();
            var m = date.getMonth();
            var y = date.getFullYear();



            $('#calendar').fullCalendar({
                header: {
                    left: 'prev,next today',
                    center: 'title',
                    right: 'month,agendaWeek,agendaDay'
                },
                editable: true,
                events: "/FullCalendarAJAXHandler.ashx"
            });

        });

    </script>

帮帮我。 我当时不知道该怎么办。

http://arshaw.com/fullcalendar/

代码给我?结果。我不知道该做什么或如何写任何其他方式。

不精通英语。我非常非常感谢大家。

public class FullCalendarAJAXHandler : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            List<CarModel> carList = new List<CarModel>();           
            var date = new DateTime();

            carList.Add(new CarModel
            {
                id = 69,
                title ="test",
                start = new DateTime(2013,07,01),
                end = new DateTime(2013,07,02),
                allDays = false
            });

            context.Response.Write(new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(carList));
        }

        public bool IsReusable
        {
            get { return false; }
        }

        private class CarModel
        {
            public int id;
            public string title;
            public DateTime start;
            public DateTime end;
            public bool allDays;
        }


    }

1 个答案:

答案 0 :(得分:0)

下载此示例。这是将fullCalendar与asp.net http://code.google.com/p/fullcalendar-asp-net/

一起使用的一个很好的例子