InputDate
InputDate
Overview
Features
Sample
Description
This sample shows the basic usage of the InputDate control.
Source
IndexController.cs
using Microsoft.AspNetCore.Mvc;
namespace MvcExplorer.Controllers
{
public partial class InputDateController : Controller
{
public ActionResult Index()
{
return View();
}
}
}
Index.cshtml
@{
var today = DateTime.Now.Date;
var minDate = new DateTime(today.Year, 1, 1);
var maxDate = new DateTime(today.Year, 12, 31);
}
@section Scripts{
<script>
function changeDate(sender, e) {
wijmo.Control.getControl("#idcCalendar").value = sender.value;
}
function weekBeforeChanged(sender, args) {
var inputDate = wijmo.Control.getControl('#idcInputDate');
inputDate.weeksBefore = sender.value;
}
function weekAfterChanged(sender, args) {
var inputDate = wijmo.Control.getControl('#idcInputDate');
inputDate.weeksAfter = sender.value;
}
function monthCountChanged(sender, args) {
var inputDate = wijmo.Control.getControl('#idcInputDate');
inputDate.monthCount = sender.value;
}
</script>
}
<p><c1-calendar id="idcCalendar" value="@today" min="@minDate" max="@maxDate" width="300px">
</c1-calendar></p>
<div>
<label>@Html.Raw(InputDateRes.Index_Text1)</label>
<c1-input-date id="idcInputDate" value="@today" min="@minDate" max="@maxDate" value-changed="changeDate">
</c1-input-date>
</div>
<br />
<fieldset>
<legend style="margin:0;padding:5px;border-bottom-width:0;border-right-width:1px;width:auto">@Html.Raw(InputDateRes.WeekBeforeAfterHeader_Text0)</legend>
<label style="font-weight:normal;">@Html.Raw(InputDateRes.WeekBefore_Text0)</label>
<c1-input-number min="0" max="10" Step="1" value="0" format="n0" value-changed="weekBeforeChanged" />
<label style="font-weight: normal;margin-top: 1em;">@Html.Raw(InputDateRes.WeekAfter_Text0)</label>
<c1-input-number min="0" max="10" Step="1" value="0" format="n0" value-changed="weekAfterChanged" />
<label style="font-weight: normal;margin-top: 1em;">@Html.Raw(InputDateRes.MonthCount_Text0)</label>
<c1-input-number min="1" max="5" step="1" value="1" format="n0" value-changed="monthCountChanged"/>
</fieldset>
@section Description{
@Html.Raw(InputDateRes.Index_Text0)
}
Documentation