InputDateRange control allows you to control its editability and state. This can be useful in the scenarios where you want limit the user from modifying the control value until some other conditions have been met, like selecting a radio button or a checkbox. Let us explore more about these modes in the following sections.
You can keep the InputDateRange control in deactivated state using the IsDisabled property. This allows you to inactivate the InputDateRange control and limit any modifications.
To disable the InputDaterange control using the IsDisabled property, use the following code:
Index.cshtml |
Copy Code
|
---|---|
@{ var today = DateTime.Now.Date; var rangeEnd = today.AddDays(4); } @(Html.C1().InputDateRange().Id("demoControl") .Value(today) .RangeEnd(rangeEnd) .IsDisabled(true) ) |
InputDateRange provides the IsReadOnly property which lets you choose whether to allow the user to modify the control value with the mouse and keyboard at runtime. To make the InputDateRange control non-editable using the IsReadOnly property, use the following code:
Index.cshtml |
Copy Code
|
---|---|
@{ var today = DateTime.Now.Date; var rangeEnd = today.AddDays(4); } @(Html.C1().InputDateRange().Id("demoControl") .Value(today) .RangeEnd(rangeEnd) .IsReadOnly(true) ) |