错误类型:LoadXML描述:不正确的XML

时间:2013-11-11 09:57:51

标签: xml asp.net-mvc calendar

我需要MVC 3应用程序中的调度程序。 在控制器中:

 public ActionResult Data()
        {
            List<MyCalendar> data = _iManageVendors.GetAllCalendarDetails();
            return View(data);
        } 

此处的数据将从数据库中检索所有值,其View Data.cshtml为

@model dynamic
           @{
               Response.ContentType = "text/xml";    
       }
<data>
    @{ foreach (var myevent in Model) {
        <MyCalendars id="@myevent.Id">
            <StartDate><![CDATA[   @String.Format("{0:MM/dd/yyyy HH:mm}",myevent.StartDate) ]]></StartDate>
            <EndDate><![CDATA[     @String.Format("{0:MM/dd/yyyy HH:mm}",myevent.EndDate) ]]></EndDate>
            <Text><![CDATA[        @myevent.Text]]></Text>
        </MyCalendars>
     } 
     }
</data>

它是一个xml视图..和 Index.cshtml

@{
    ViewBag.Title = "Home Page";
    Layout = null;
}
<head>
<script src="http://www.codeproject.com/Scripts/dhtmlxscheduler.js" type="text/javascript"></script>
<link href="http://www.codeproject.com/Scripts/dhtmlxscheduler.css" rel="stylesheet" type="text/css" />

<style type="text/css">
            html, body
            {
                height:100%;
                padding:0px;
                margin:0px;
            }
        </style>

<script type="text/javascript">
    function init() {
        debugger;
        alert(scheduler);
        scheduler.config.xml_date = "%m/%d/%Y %H:%i";
        scheduler.init("scheduler_here", new Date(2013, 6, 1), "month");
        scheduler.load("/Home/Tasks");

        var dp = new dataProcessor("/Home/Save");
        dp.init(scheduler);
        dp.setTransactionMode("POST", false);
    }
</script>
</head>

<body onload="init()">
<div id="scheduler_here" class="dhx_cal_container" style='width: 100%; height: 100%;'>
    <div class="dhx_cal_navline">
        <div class="dhx_cal_prev_button">
            &nbsp;</div>
        <div class="dhx_cal_next_button">
            &nbsp;</div>
        <div class="dhx_cal_today_button">
        </div>
        <div class="dhx_cal_date">
        </div>
        <div class="dhx_cal_tab" name="day_tab" style="right: 204px;">
        </div>
        <div class="dhx_cal_tab" name="week_tab" style="right: 140px;">
        </div>
        <div class="dhx_cal_tab" name="month_tab" style="right: 76px;">
        </div>
    </div>
    <div class="dhx_cal_header">
    </div>
    <div class="dhx_cal_data">
    </div>
</div>
</body>

但是当我加载页面时,日历的视图即将到来,但xml中有一些错误。任何人都可以帮我解决这个问题吗?

enter image description here

1 个答案:

答案 0 :(得分:0)

当我在dhtmlxscheduler.js中提供相同名称的事件,start_date,end_date,text,..时,我得到了答案。