search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Serialisation not working properly on update

Asked by ge0rgi
10 years ago.

In my project I don't have direct access to an SQL database, so I can't fill the events List as described in the tutorials. So I have created a dummy DataTable like this:

DataTable table = new DataTable();
table.Columns.Add("id", typeof(int));
table.Columns.Add("AktID", typeof(int));
table.Columns.Add("Description", typeof(string));
table.Columns.Add("Start", typeof(DateTime));
table.Columns.Add("End", typeof(DateTime));
table.PrimaryKey = new DataColumn[] { table.Columns["id"], table.Columns["AktID"] };

And I fill it with my custom data objects

Initialization looks like this
protected override void OnInit(InitArgs e)
{

DataIdField = "AktID";
DataTextField = "Description";
DataStartField = "Start";
DataEndField = "End";
WeekStarts = DayPilot.Web.Mvc.Enums.WeekStarts.Monday;
DateTime today = DateTime.Now;
Events = GetDayPilotEvents(myClient.UID, today.Month, today.Year).AsEnumerable(); // Fills data table
Update();
}
This works. However
The problem is when I update the data after initialization by replacing Events and calling update the data is not serialized properly
Instead of the AktID the Id column is used and the text column is not filled at all. The start and end times are correct. How do I fix this? Is there any way to use this library without using DataTable?

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.