I have a Kendo UI MVC control on my asp.net MVC page, i want to highlight specific dates based on information from my database. EG on 9/Aug/2012 there were 7 appointments raised.
I'd like to use the custom template like this
<%= Html.Kendo().Calendar()
.Name("calendar")
.Value(DateTime.Today)
.HtmlAttributes(new { style = "width:330px" })
.Footer("Today - #=kendo.toString(data, 'd') #")
.MonthTemplate("# if ($.inArray(+data.date, events) != -1) { #" +
"'<div class=\"" +
"# if (data.value < 10) { #" +
"exhibition" +
"# } else if ( data.value < 20 ) { #" +
"party" +
"# } else { #" +
"cocktail" +
"# } #" +
"\"></div>" +
"# } #" +
"#= data.value #")
%>
<script>
var today = new Date(),
events = [
+new Date(today.getFullYear(), today.getMonth(), 8),
+new Date(today.getFullYear(), today.getMonth(), 12),
+new Date(today.getFullYear(), today.getMonth(), 24),
+new Date(today.getFullYear(), today.getMonth() + 1, 6),
+new Date(today.getFullYear(), today.getMonth() + 1, 7),
+new Date(today.getFullYear(), today.getMonth() + 1, 25),
+new Date(today.getFullYear(), today.getMonth() + 1, 27),
+new Date(today.getFullYear(), today.getMonth() - 1, 3),
+new Date(today.getFullYear(), today.getMonth() - 1, 5),
+new Date(today.getFullYear(), today.getMonth() - 2, 22),
+new Date(today.getFullYear(), today.getMonth() - 2, 27)
];
</script>
How can I replace the above javascript array with an array on my viewmodel?
Something like this -
.MonthTemplate("# if ($.inArray(+data.date, " + Model.Array + ") != -1) { #" +
"'<div class=\"" +
"# if (data.value < 10) { #" +
"exhibition" +
"# } else if ( data.value < 20 ) { #" +
"party" +
"# } else { #" +
"cocktail" +
"# } #" +
"\"></div>" +
"# } #" +
"#= data.value #")
%>
Thanks
I'd like to use the custom template like this
<%= Html.Kendo().Calendar()
.Name("calendar")
.Value(DateTime.Today)
.HtmlAttributes(new { style = "width:330px" })
.Footer("Today - #=kendo.toString(data, 'd') #")
.MonthTemplate("# if ($.inArray(+data.date, events) != -1) { #" +
"'<div class=\"" +
"# if (data.value < 10) { #" +
"exhibition" +
"# } else if ( data.value < 20 ) { #" +
"party" +
"# } else { #" +
"cocktail" +
"# } #" +
"\"></div>" +
"# } #" +
"#= data.value #")
%>
<script>
var today = new Date(),
events = [
+new Date(today.getFullYear(), today.getMonth(), 8),
+new Date(today.getFullYear(), today.getMonth(), 12),
+new Date(today.getFullYear(), today.getMonth(), 24),
+new Date(today.getFullYear(), today.getMonth() + 1, 6),
+new Date(today.getFullYear(), today.getMonth() + 1, 7),
+new Date(today.getFullYear(), today.getMonth() + 1, 25),
+new Date(today.getFullYear(), today.getMonth() + 1, 27),
+new Date(today.getFullYear(), today.getMonth() - 1, 3),
+new Date(today.getFullYear(), today.getMonth() - 1, 5),
+new Date(today.getFullYear(), today.getMonth() - 2, 22),
+new Date(today.getFullYear(), today.getMonth() - 2, 27)
];
</script>
How can I replace the above javascript array with an array on my viewmodel?
Something like this -
.MonthTemplate("# if ($.inArray(+data.date, " + Model.Array + ") != -1) { #" +
"'<div class=\"" +
"# if (data.value < 10) { #" +
"exhibition" +
"# } else if ( data.value < 20 ) { #" +
"party" +
"# } else { #" +
"cocktail" +
"# } #" +
"\"></div>" +
"# } #" +
"#= data.value #")
%>
Thanks