Hello,
<rec_type> <![CDATA[<%= Convert.ToInt16(myevent.rec_type) %>]]></rec_type> <%} %>
why do you convert rec_type to short int? A typical rec_type looks like this ‘week_1____’ - it can’t be converted to number.
Similar issues may be related to event_pid:
<event_pid> <![CDATA[<%= Convert.ToInt32(myevent.event_pid) %>]]></event_pid> <%} %>
event_pid stores an id of parent series, and id is not necessary an integer value.
It would be easier to treat rec_type, event_length and event_pid as strings, i.e. instead of this:
[code]<% if (myevent.rec_type != “” )
{ %>
<rec_type> ]]></rec_type> <%} %>
<% if (myevent.event_length != null)
{ %>
<event_length> ]]></event_length> <%} %>
<% if (myevent.event_pid != null)
{ %>
<event_pid> ]]></event_pid> <%} %>
<% } %>[/code]
have this:
<rec_type> <![CDATA[<%= myevent.rec_type %>]]></rec_type> <%} %>
<event_length> <![CDATA[<%= myevent.event_length == null ? "" : myevent.event_length %>]]></event_length> <%} %>
<event_pid> <![CDATA[<%= myevent.event_pid == null ? "" : myevent.event_pid %>]]></event_pid> <%} %>
</event>
What would be even easier is to switch data loading to JSON.
Client side:
scheduler.load("data.ashx", "json");
Server side:
[code]var data = new SchedulerDataContext();// EF or LinqToSql data context
var viewData = dc.Recurrings.Select(e => new
{
e.id,
e.text,
start_date = String.Format("{0:MM/dd/yyyy HH:mm}", e.start_date),
end_date = String.Format("{0:MM/dd/yyyy HH:mm}", e.end_date),
e.color,
e.rec_type,
e.event_length,
e.event_pid
});
var serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
// HttpContext or HttpResponse
context.Response.ContentType = “text/json”;
context.Response.Write(serializer.Serialize(viewData));
[/code]