在MVC 4.0中实现Calendar

时间:2013-12-02 10:37:32

标签: asp.net-mvc-3 asp.net-mvc-4 events calendar scheduled-tasks

我要求使用“DayPilotLite”添加日历 在MVC中。  所以,我已经下载了演示并安装在我当前的mvc 4.0应用程序中。 我现在要求在任何事件的悬停上显示“泡沫”。 所以,我想要得到它,但我没有太多 有关daypilot lite的信息。甚至谷歌搜索并找出一些解决方案,但两者都没有 他们正在工作。

I am referring to this link
http://mvc.daypilot.org/adding-event-bubble-to-daypilot-calendar/

but  this extension does not exists in there dll

<%=Html.DayPilotBubble("bubble", new DayPilotBubbleConfig{})%> 

DayPilotbubble在它的HTMl Helper中不存在。请帮我 。我非常失望。

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="DayPilot.Web.Mvc.Enums.Calendar" %>
<%@ Import Namespace="DayPilot.Web.Mvc.Events.Calendar" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    AJAX Drag&amp;Drop Event Calendar
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">



<script type="text/javascript">

    function createEvent(start, end, resource) {
        modal().showUrl("<%= ResolveUrl("~/Dialog/NewEvent") %>?start=" + start.toStringSortable() + "&end=" + end.toStringSortable());
    }

    function editEvent(id) {
        modal().showUrl("<%= ResolveUrl("~/Dialog/Edit/") %>" + id);
    }

    function modal() {
        var modal = new DayPilot.Modal();
        modal.top = 60;
        modal.width = 500;
        modal.opacity = 30;
        modal.border = "5px solid #d0d0d0";
        modal.closed = function () {
            if (this.result == "OK") {

                dpc.commandCallBack('refresh');
            }
            dpc.clearSelection();
        };

        modal.height = 600;
        return modal;
    }

       $("#divPrint").live("click", function (e) {
          window.print();
        });

</script>

<%--<div class="note"><b>Note:</b> This page uses the customizable <a href="http://code.daypilot.org/81367/daypilot-modal">DayPilot modal dialog</a> for event creating and editing.</div>--%>
<div style="padding-bottom:10px;cursor:pointer;" id="divPrint">Print</div>

<div>


        <%= Html.DayPilotCalendar("dpc", new DayPilotCalendarConfig { 
                BackendUrl = ResolveUrl("~/Calendar/Backend"),
                ViewType = DayPilot.Web.Mvc.Enums.Calendar.ViewType.Week,

                TimeRangeSelectedHandling = TimeRangeSelectedHandlingType.JavaScript,
                TimeRangeSelectedJavaScript = "createEvent(start, end)",
                EventMoveHandling = EventMoveHandlingType.CallBack,
                EventResizeHandling = EventResizeHandlingType.CallBack,
                EventClickHandling = EventClickHandlingType.JavaScript,
                EventClickJavaScript = "editEvent(e.value());",             
                LoadingLabelText="<img src='" + ResolveUrl("~/Media/linked/ajax-loader-round.gif") + "' />",
                LoadingLabelBackColor="",
        })%>
</div>

</asp:Content>

2 个答案:

答案 0 :(得分:0)

尝试添加

<add namespace="DayPilot.Web.Mvc" />

进入Views/Web.confing文件。您需要在configuration->system.web.webPages.razor->pages->namespaces部分添加它 您的命名空间部分应如下所示:

<namespaces>
   <add namespace="System.Web.Mvc" />
   <add namespace="System.Web.Mvc.Ajax" />
   <add namespace="System.Web.Mvc.Html" />
   <add namespace="System.Web.Routing" />
   <add namespace="DayPilot.Web.Mvc" />
</namespaces>

它会为您的所有视图添加对DayPilot.Web.Mvc命名空间全局的引用。 您还可以选择将<%@ Import Namespace="DayPilot.Web.Mvc" %>添加到使用适当帮助程序扩展的每个视图。

答案 1 :(得分:0)

据我所知,DayPilotLite没有Bubble支持。它仅适用于MV版的专业版。