【问题标题】:DayPilot calendar won't show at allDayPilot 日历根本不显示
【发布时间】:2017-10-14 15:18:39
【问题描述】:

我正在尝试实现一个日历,它只会显示已经进行的预订,并且在数据库的表格中。

学习本教程后: https://www.codeproject.com/Articles/404647/AJAX-Event-Calendar-Scheduler-for-ASP-NET-MVC-3-in

我有一个空白区域,日历应该是,它似乎留下了很大的区域,所以我不确定它哪里出了问题,或者它是否没有呈现它或其他什么。我没有错误,也看不出哪里出错了。

Gyazo Screenshot

这是我对日历的看法:

@{
    ViewBag.Title = "Booking Calander";
}

<h2>All Bookings</h2>

<div id="dp">

    <script src="@Url.Content("~/Scripts/DayPilot/daypilot-all.min.js")" type="text/javascript"></script>

    @Html.DayPilotCalendar("dpc", new DayPilotCalendarConfig
    {
    BackendUrl = Url.Content("~/Home/BookingCalander"),
    })


</div>

这是我在控制器中的内容(它只是在家庭控制器中):

    public ActionResult BookingCalander()
    {
        return View();
    }

    public ActionResult Backend()
    {
        return new Dpc().CallBack(this);
    }

    public class Dpc : DayPilotCalendar
    {
        protected override void OnInit(InitArgs e)
        {
            var db = new ApplicationDbContext();
            Events = from ev in db.HallBookings select ev;

            DataIdField = "ActivityBookingId";
            DataTextField = "Activity" + " - " + "CustomerName";
            DataStartField = "BookingStartTime";
            DataEndField = "BookingEndTime";

            Update();
        }
    }

我已将命名空间添加到 Views/Web.Config:

      <namespaces>

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

      </namespaces>
    </pages>
  </system.web.webPages.razor>

【问题讨论】:

  • 请注意,model-view-controller 标签是针对有关模式的问题。 ASP.NET-MVC 实现有一个特定的标记。

标签: c# asp.net-mvc daypilot


【解决方案1】:

BackendUrl 应该指向“Backend”动作(顾名思义):

@Html.DayPilotCalendar("dpc", new DayPilotCalendarConfig
{
  BackendUrl = Url.Content("~/Home/Backend"),
})

【讨论】:

    猜你喜欢
    • 2016-01-04
    • 2015-06-16
    • 2017-10-06
    • 1970-01-01
    • 2015-07-16
    • 2014-04-23
    • 2021-06-01
    • 2013-05-19
    • 2015-11-28
    相关资源
    最近更新 更多