So is this the only way to pass the value that has been selected back to the server ...seems like way too much glue code , I have to have a hidden field, then need to use JS to fill that field etc etc
Jay
Jay
<body>
@using (Html.BeginForm(
"Index"
,
"Home"
, FormMethod.Post))
{
@Html.HiddenFor(m => m.StartDate)
@(Html.Kendo().Calendar()
.Name(
"calendarStart"
)
.Value(DateTime.Now)
)
@Html.HiddenFor(m => m.EndDate)
@(Html.Kendo().Calendar()
.Name(
"calendarEnd"
)
.Value(DateTime.Now)
)
<button name=
"button"
value=
"save"
>Save Date</button>
}
<script>
$(document).ready(
function
() {
var
calendarStart = $(
"#calendarStart"
).data(
"kendoCalendar"
);
$(
"#StartDate"
).val((moment(calendarStart.value()).format(
"YYYY-MM-DD"
)));
calendarStart.bind(
"change"
,
function
(e) {
$(
"#StartDate"
).val((moment(
this
.value())).format(
"YYYY-MM-DD"
));
});
var
calendarEnd = $(
"#calendarStart"
).data(
"kendoCalendar"
);
$(
"#EndDate"
).val((moment(calendarEnd.value()).format(
"YYYY-MM-DD"
)));
calendarEnd.bind(
"change"
,
function
(e) {
$(
"#EndDate"
).val((moment(
this
.value())).format(
"YYYY-MM-DD"
));
});
});
</script>
</body>