This is a migrated thread and some comments may be shown as answers.

I have create asp .net razor view and date are not being set.

9 Answers 232 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Damion
Top achievements
Rank 1
Damion asked on 22 Dec 2013, 11:50 AM
Hi

I have created a scheduler in our mvc 5 application ad I dont seem to be able to pass dates around.

I have created a CalendarViewModel that implements IScheduleEvent but if I populate a new CalendarViewModel object and pass it to the view I dont get any events showing. To make things worse when I double click a time and fill in the details, the title and description gets passed back to my create event but the end and start dates are empty.

Any ideas what I am missing

My view looks like this 

 @(Html.Kendo().Scheduler<TalkBox.Mvc.ViewModels.Calendar.CalendarViewModel>()
                  .Name("scheduler")
                  .Date(DateTime.UtcNow)
                  .Editable(true)
                  .Height(700)
                  .BindTo(Model)
                  .Views(views =>
                            {
                                views.DayView();
                                views.WeekView();
                                views.MonthView(monthView => monthView.Selected(true));
                            })
                   .DataSource(d => d.Model(m => m.Id(f => f.EventId))
                        .Create("Create", "Calendar")
                        .Update("Update", "Calendar")
                        .Destroy("Delete","Calendar")
                    )
            )
   
Added to this the ModelState.IsValid is false, but I guess this is because the dates are not set.

I have included images from the create event that shows that I recieve the title and description and the network traffic from chrome's inspect element that show the dates are being passed.

9 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 23 Dec 2013, 09:10 AM
Hi Damion,

The request URL doesn't look right. The scheduler shouldn't be making GET requests and not use that date format. Could you please check if you have included kendo.aspnetmvc.min.js in your application? This file is responsible for configuring the scheduler in ASP.NET MVC applications.

Regards,
Atanas Korchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Damion
Top achievements
Rank 1
answered on 23 Dec 2013, 01:09 PM
Hi

Thanks for that but it has not made any improvement. I have added the file you recommend and the call is now a post. However I am still not getting the dates and even though the ModelState.IsValid is false the window closes and the calendar event is added.

Damion
0
Damion
Top achievements
Rank 1
answered on 23 Dec 2013, 01:12 PM
Added to this the update (dragging the bottom of the calendar event) fires 4 create events.

Damion
0
Atanas Korchev
Telerik team
answered on 23 Dec 2013, 01:40 PM
Hi Damion,

Have you tried the ASP.NET MVC sample application which ships as part of the distribution? Does it work at your side?

Regards,
Atanas Korchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Damion
Top achievements
Rank 1
answered on 23 Dec 2013, 02:53 PM
Ah thanks for that I have just tried the 

http://localhost:8301/razor/web/scheduler/index

And that does not work either.

Damion
0
Atanas Korchev
Telerik team
answered on 23 Dec 2013, 03:04 PM
Hi Damion,

This is really strange. Could you please describe your configuration?

  1. System locale
  2. Operating System
  3. Browser and version

It looks as if dates are not sent in a format that ASP.NET MVC can properly parse. You can also show us how the request looks from your browser developer tools.

Regards,
Atanas Korchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Damion
Top achievements
Rank 1
answered on 23 Dec 2013, 03:36 PM


  • System locale
United Kingdom

  • Operating System
Windows 8 (NOT 8.1)
  • Browser and version
Chrome Version 31.0.1650.63 m

Reequest from  ASP.NET MVC sample application


Origin: http://localhost:57872
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Referer: http://localhost:57872/razor/web/scheduler/index
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8,vi;q=0.6
Cookie: __RequestVerificationToken=U3r2_0bSWNtOf14kXrunGmJr-rA8mP_QGQ5ObAEeTnhg6zQ0J3-0QcfifoRzq5WP-tNgFzfcyChF2I7mQkpYB4_im8k1; ASP.NET_SessionId=s1ysoiivnhd31cnebb2jjc3x; yecco.com=undefined
DNT: 1
Form Dataview sourceview URL encoded
sort:
group:
filter:
startTimezone:
endTimezone:
TaskID:0
StartTimezone:
EndTimezone:
OwnerID:1
Title:test
Description:test
Start:6/13/2013 8:30:00 AM
End:6/13/2013 9:00:00 AM
RecurrenceRule:
RecurrenceException:
IsAllDay:false
Response Headersview source
Cache-Control:private
Connection:Close
Content-Length:18581
Content-Type:text/html; charset=utf-8
Date:Mon, 23 Dec 2013 15:34:56 GMT
Server:ASP.NET Development Server/10.0.0.0
X-AspNet-Version:4.0.30319

Request URL:http://localhost:57872/razor/web/Scheduler/CreateRequest Method:POSTStatus Code:500 Internal Server ErrorRequest Headersview parsedPOST /razor/web/Scheduler/Create HTTP/1.1
Host: localhost:57872
Connection: keep-alive
Content-Length: 243
Accept: */*
Origin: http://localhost:57872
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Referer: http://localhost:57872/razor/web/scheduler/index
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8,vi;q=0.6
Cookie: __RequestVerificationToken=U3r2_0bSWNtOf14kXrunGmJr-rA8mP_QGQ5ObAEeTnhg6zQ0J3-0QcfifoRzq5WP-tNgFzfcyChF2I7mQkpYB4_im8k1; ASP.NET_SessionId=s1ysoiivnhd31cnebb2jjc3x; yecco.com=undefined
DNT: 1Form Dataview sourceview URL encodedsort:group:filter:startTimezone:endTimezone:TaskID:0StartTimezone:EndTimezone:OwnerID:1Title:testDescription:testStart:6/13/2013 8:30:00 AMEnd:6/13/2013 9:00:00 AMRecurrenceRule:RecurrenceException:IsAllDay:falseResponse Headersview sourceCache-Control:privateConnection:CloseContent-Length:18581Content-Type:text/html; charset=utf-8Date:Mon, 23 Dec 2013 15:34:56 GMTServer:ASP.NET Development Server/10.0.0.0X-AspNet-Version:4.0.30319


Request URL:http://localhost:57872/razor/web/Scheduler/CreateRequest Method:POSTStatus Code:500 Internal Server ErrorRequest Headersview parsedPOST /razor/web/Scheduler/Create HTTP/1.1
Host: localhost:57872
Connection: keep-alive
Content-Length: 243
Accept: */*
Origin: http://localhost:57872
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Referer: http://localhost:57872/razor/web/scheduler/index
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8,vi;q=0.6
Cookie: __RequestVerificationToken=U3r2_0bSWNtOf14kXrunGmJr-rA8mP_QGQ5ObAEeTnhg6zQ0J3-0QcfifoRzq5WP-tNgFzfcyChF2I7mQkpYB4_im8k1; ASP.NET_SessionId=s1ysoiivnhd31cnebb2jjc3x; yecco.com=undefined
DNT: 1Form Dataview sourceview URL encodedsort:group:filter:startTimezone:endTimezone:TaskID:0StartTimezone:EndTimezone:OwnerID:1Title:testDescription:testStart:6/13/2013 8:30:00 AMEnd:6/13/2013 9:00:00 AMRecurrenceRule:RecurrenceException:IsAllDay:falseResponse Headersview sourceCache-Control:privateConnection:CloseContent-Length:18581Content-Type:text/html; charset=utf-8Date:Mon, 23 Dec 2013 15:34:56 GMTServer:ASP.NET Development Server/10.0.0.0X-AspNet-Version:4.0.30319



AND THE response

<!DOCTYPE html>
<html>
    <head>
        <title>The resource cannot be found.</title>
        <meta name="viewport" content="width=device-width" />
        <style>
         body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} 
         p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
         b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
         H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
         H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
         pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt}
         .marker {font-weight: bold; color: black;text-decoration: none;}
         .version {color: gray;}
         .error {margin-bottom: 10px;}
         .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
         @media screen and (max-width: 639px) {
          pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; }
         }
         @media screen and (max-width: 479px) {
          pre { width: 280px; }
         }
        </style>
    </head>

    <body bgcolor="white">

            <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>

            <h2> <i>The resource cannot be found.</i> </h2></span>

            <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">

            <b> Description: </b>HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. &nbsp;Please review the following URL and make sure that it is spelled correctly.
            <br><br>

            <b> Requested URL: </b>/Scripts/jquery.min.map<br><br>

            <hr width=100% size=1 color=silver>

            <b>Version Information:</b>&nbsp;Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18331

            </font>

    </body>
</html>
<!-- 
[HttpException]: The controller for path &#39;/Scripts/jquery.min.map&#39; was not found or does not implement IController.
   at System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType)
   at System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName)
   at System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory)
   at System.Web.Mvc.MvcHandler.<>c__DisplayClass6.<BeginProcessRequest>b__2()
   at System.Web.Mvc.SecurityUtil.<>c__DisplayClassb`1.<ProcessInApplicationTrust>b__a()
   at System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f)
   at System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action)
   at System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust[TResult](Func`1 func)
   at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state)
   at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state)
   at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
-->
0
Alex Gyoshev
Telerik team
answered on 25 Dec 2013, 12:54 PM
Hello Daimon,

The posted response appears to be the failed request for the jquery source map. This shouldn't cause a problem with the scheduler, as these are loaded only when the chrome console is opened. Can you please send a HAR file for the request, so that we can inspect it? To do so, open the page, then the Chrome dev tools, switch to the network tab, clear it, refresh the page with the dev tools opened, right click somewhere in the network grid and click "Save as HAR with content". The content of that file can be visualized in a HAR viewer and will help us determine the problem.

Regards,
Alex Gyoshev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Damion
Top achievements
Rank 1
answered on 27 Dec 2013, 04:04 PM
Thanks for your input but we eventually got to the bottom of the problem 

The dates being received by the create method were in the wrong format do we had to add

     <script src="http://cdn.kendostatic.com/2012.2.710/js/cultures/kendo.culture.en-GB.min.js"></script>

and the following to our scripts
        kendo.culture("en-GB");

Damion
Tags
Scheduler
Asked by
Damion
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Damion
Top achievements
Rank 1
Alex Gyoshev
Telerik team
Share this question
or