Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/294.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 从数据库检索完整日历_C#_Asp.net_Sql_Razor_Fullcalendar - Fatal编程技术网

C# 从数据库检索完整日历

C# 从数据库检索完整日历,c#,asp.net,sql,razor,fullcalendar,C#,Asp.net,Sql,Razor,Fullcalendar,我正在尝试使用在线呈现时间表。理想情况下,我希望有很多功能。最初,我希望将其连接到SQL数据库,从包含特定用户事件的表中检索数据。我使用的是SQL compact server和C以及Razor语法。做这件事最好的方法是什么 我正在使用网站上的可选演示,目前我的代码如下: <html> <link rel='stylesheet' type='text/css' href='../fullcalendar/fullcalendar.css' /> <link rel

我正在尝试使用在线呈现时间表。理想情况下,我希望有很多功能。最初,我希望将其连接到SQL数据库,从包含特定用户事件的表中检索数据。我使用的是SQL compact server和C以及Razor语法。做这件事最好的方法是什么

我正在使用网站上的可选演示,目前我的代码如下:

<html>
<link rel='stylesheet' type='text/css' href='../fullcalendar/fullcalendar.css' />
<link rel='stylesheet' type='text/css' href='../fullcalendar/fullcalendar.print.css' media='print' />
<script type='text/javascript' src='../jquery/jquery-1.7.1.min.js'></script>
<script type='text/javascript' src='../jquery/jquery-ui-1.8.17.custom.min.js'></script>
<script type='text/javascript' src='../fullcalendar/fullcalendar.min.js'></script>
<script type='text/javascript'>

    $(document).ready(function() {

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

        var calendar = $('#calendar').fullCalendar({
            header: {
                left: 'prev,next today',
                center: 'title',
                right: 'month,agendaWeek,agendaDay'
            },
            selectable: true,
            selectHelper: true,
            select: function(start, end, allDay) {
                var title = prompt('Event Title:');
                if (title) {
                    calendar.fullCalendar('renderEvent',
                        {
                            title: title,
                            start: start,
                            end: end,
                            allDay: allDay
                        },
                        true // make the event "stick"
                    );
                }
                calendar.fullCalendar('unselect');
            },
            editable: true,
            events: [
                {
                    title: 'All Day Event',
                    start: new Date(y, m, 1)
                },
                {
                    title: 'Long Event',
                    start: new Date(y, m, d-5),
                    end: new Date(y, m, d-2)
                },
                {
                    id: 999,
                    title: 'Repeating Event',
                    start: new Date(y, m, d-3, 16, 0),
                    allDay: false
                },
                {
                    id: 999,
                    title: 'Repeating Event',
                    start: new Date(y, m, d+4, 16, 0),
                    allDay: false
                },
                {
                    title: 'Meeting',
                    start: new Date(y, m, d, 10, 30),
                    allDay: false
                },
                {
                    title: 'Lunch',
                    start: new Date(y, m, d, 12, 0),
                    end: new Date(y, m, d, 14, 0),
                    allDay: false
                },
                {
                    title: 'Birthday Party',
                    start: new Date(y, m, d+1, 19, 0),
                    end: new Date(y, m, d+1, 22, 30),
                    allDay: false
                },
                {
                    title: 'Click for Google',
                    start: new Date(y, m, 28),
                    end: new Date(y, m, 29),
                    url: 'http://google.com/'
                }
            ]
        });

    });

</script>
<style type='text/css'>

    body {
        text-align: center;
        font-size: 14px;
        font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
        }

    #calendar {
        width: 800px;
        margin: 0 auto;
        }

</style>
</head>
<body>
<div id='calendar'></div>
</body>
</html>

使用此函数在JavaScript中填充我的事件的最佳方式是什么?

我将看一些其他示例,例如json提要。在这里,您可以使用php,或者在我的例子中使用到后端数据库的.net连接,该数据库将作为json提要提供“回复”。FullCallendar拥有解释和显示此提要的所有代码

@{
    var db = Database.Open("myDB");
    var Name = Request["Title"];
    var Description = Request["Start"];
    var Price = Request["End"];
    var allDay = Request["myDB"];
}