start_date and end_date not being set in database

Hi

I am following the room booking tutorial, but my events in the database are not showing in the calendar.

When i run the application, and try to add a new event, the id and text fields are completed in my database but not the datetime fileds.

Im guessing this has something to do with the format of the datetime fields but i dont know how to change them?

Im using Visual Studio 2010 and MVC 3 with razor

yes, it could be related to the date format of the calendar.
App uses MVC model binder which is using current locale to parse dates from request values, while scheduler sends dates as MM/dd/yyyy HH:mm.
Try changing scheduler’s date format:
scheduler.config.xml_date = “%d/%m/%Y %H:%i”;
docs.dhtmlx.com/doku.php?id=dhtm … ngs_format

I think i may have a bigger problem…I cant find:

scheduler.config.xml_date

Where is this located?

could you please specify what exactly tutorial you’ve been following?
If you use dhtmlxScheduler for .Net, this property can be accessed from server-side: DHXScheduler.Config.xml_date it’s also available on the client
js: scheduler.config.xml_date

Thanks for your reply

i have been following dhtmlx.com/blog/?p=639

I have managed to find this in the .js file and have changed it from xml_date:"%m/%d/%Y %H:%i" to xml_date:"%d/%m/%Y %H:%i" but still not working

heres a little more info for you if it helps

Data.cshtml

@{ Layout = null; Response.ContentType = "text/xml"; } @model IEnumerable<MyCalendar.Models.Event> <data> @foreach (var myevent in Model) { <event id="@myevent.id"> <start_date><![CDATA[@String.Format("{0:dd/mm/yyyy HH:mm}",myevent.start_date)]]></start_date> <end_date><![CDATA[@String.Format("{0:dd/mm/yyyy HH:mm}",myevent.end_date)]]></end_date> <text><![CDATA[@myevent.text]]></text> </event> } </data>

dhtmlschedular.js

xml_date:"%d/%m/%Y %H:%i",api_date:"%d-%m-%Y %H:%i",

database

CREATE TABLE [dbo].[Events] ( [Id] INT IDENTITY (1, 1) NOT NULL, [text] NVARCHAR (MAX) NULL, [start_date] DATETIME NULL, [end_date] DATETIME NULL, PRIMARY KEY CLUSTERED ([Id] ASC) );

Hi,
modifying of source files is not recomended. You can change date format during initialization of the calendar. See following lines of the tutorial:function init() { scheduler.config.xml_date = "%m/%d/%Y %H:%i"; // format of dates in XML scheduler.init("scheduler_here", new Date(2010, 6, 1), "month"); scheduler.load("/Calendar/Data"); //path to the newly created action }
And try creating events from request values as shown in “Step 3 – Saving to the Database”, so you’ll see if dates are parsed incorrectly

Ive now got the correct data saving to the database from the view, but data is not being loaded from the database and displayed into the calendar

Make sure date format used in Data.cshtml matches the one from scheduler.config.xml_date.
You may also attach the project so I could test it locally

Hello,
I have the same issue but am using java struts and hibernate.
I can not find the Data.cshtml file though, what do u suggest?
Thanks in advance.

Hi,
please check in which format your server side expects to recieve dates from the client, and which format it uses to send it to the client-side on loading.

The client-side has xml_date setting
docs.dhtmlx.com/scheduler/api__s … onfig.html
It defines the format in which client send the dates to the server and from which it tries to parse them when loads events from the backend.

The common solution of the problem is modifying xml_date format so server side could parse