mainrotor
asked on
Need help assigning a max date value to my Kendo DatePicker control
Hi Experts,
I have an MVC.Net application with C# code behind.
I need help assigning a max date value to my Kendo UI control.
I want the max date to be the current date. I have tried some code but it's not working (see code below).
What can I do to make this work?
CURRENT CODE THATS NOT WORKING
Thank you in advance,
mrotor
I have an MVC.Net application with C# code behind.
I need help assigning a max date value to my Kendo UI control.
I want the max date to be the current date. I have tried some code but it's not working (see code below).
What can I do to make this work?
CURRENT CODE THATS NOT WORKING
<script>
$(document).ready(function () {
var today = new Date();
var maxDate = todayx.setDate(today.getDate());
$("#EndDate").kendoDatePicker({
max: new Date(maxDate)
});
});
</script>
<table class="aTable" border="0">
<tr class="aRow">
<td class="right1">
To:
@(Html.Kendo().DatePicker().Name("EndDate")
.HtmlAttributes(new { @class = "dataPickerStyle", title = "End Date" }))
</td>
</tr>
</table>
Thank you in advance,
mrotor
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Flabio and Ryan,
I tried both our your suggestions but it still not working.
Sorry that the todayx in m y code caused confusion. It was left there accidently. I thought I had cleaned up my code.
This is how my code should look like after further clean up. Ha ha.
I tried both our your suggestions but it still not working.
Sorry that the todayx in m y code caused confusion. It was left there accidently. I thought I had cleaned up my code.
This is how my code should look like after further clean up. Ha ha.
<script>
$(document).ready(function () {
var today = new Date();
var maxDate = today.setDate(today.getDate());
$("#EndDate").kendoDatePicker({
max: new Date(maxDate)
});
});
</script>
<table class="aTable" border="0">
<tr class="aRow">
<td class="right1">
To:
@(Html.Kendo().DatePicker().Name("EndDate")
.HtmlAttributes(new { @class = "dataPickerStyle", title = "End Date" }))
</td>
</tr>
</table>
I didn't use kendoDatePicker but I think Flabio's solution should work for you...
<script>
$(document).ready(function () {
var today = new Date();
$("#EndDate").kendoDatePic ker({
max: today
});
});
</script>
<script>
$(document).ready(function
var today = new Date();
$("#EndDate").kendoDatePic
max: today
});
});
</script>
ASKER
Flabio's solution didn't work for me. :-(
Apparently, Kendo is a non-free JQuery plugin. Best you ask their support page.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Question inactive
Open in new window
to:
Open in new window