在 DevExpress DateEditFor 控件上,如何仅通过单击日历而不是手动输入来强制选择日期
On the DevExpress DateEditFor control, how to force date selection only by clicking in the calendar and never manually entered
在 MVC DevExpress DateEditFor 中,(由一个文本框和一个下拉弹出日历组成)是否有一种方法可以禁止用户直接在文本框中输入日期,从而强制选择只能通过单击在日历中 ?
@Html.DevExpress().DateEditFor(m => m.StartDateReserv, settings =>
{
settings.Properties.CalendarProperties.FastNavProperties.Enabled = false;
settings.Properties.AllowNull = true;
settings.Properties.MinDate = DateTime.Today;
settings.Properties.EditFormat = EditFormat.Date;
settings.Properties.DisplayFormatString = "d";
settings.Properties.ShowOutOfRangeWarning = false;
settings.ShowModelErrors = false;
settings.Properties.CalendarProperties.ShowClearButton = false;
settings.Properties.CalendarProperties.ShowTodayButton = false;
settings.Properties.CalendarProperties.ShowWeekNumbers = false;
settings.Properties.CalendarProperties.EnableYearNavigation = false;
settings.Properties.ClientSideEvents.GotFocus = "function(s, e) { s.ShowDropDown(); }";
}).GetHtml()
您应该可以通过以下设置完成此操作:
settings.Properties.AllowUserInput = false;
在 MVC DevExpress DateEditFor 中,(由一个文本框和一个下拉弹出日历组成)是否有一种方法可以禁止用户直接在文本框中输入日期,从而强制选择只能通过单击在日历中 ?
@Html.DevExpress().DateEditFor(m => m.StartDateReserv, settings =>
{
settings.Properties.CalendarProperties.FastNavProperties.Enabled = false;
settings.Properties.AllowNull = true;
settings.Properties.MinDate = DateTime.Today;
settings.Properties.EditFormat = EditFormat.Date;
settings.Properties.DisplayFormatString = "d";
settings.Properties.ShowOutOfRangeWarning = false;
settings.ShowModelErrors = false;
settings.Properties.CalendarProperties.ShowClearButton = false;
settings.Properties.CalendarProperties.ShowTodayButton = false;
settings.Properties.CalendarProperties.ShowWeekNumbers = false;
settings.Properties.CalendarProperties.EnableYearNavigation = false;
settings.Properties.ClientSideEvents.GotFocus = "function(s, e) { s.ShowDropDown(); }";
}).GetHtml()
您应该可以通过以下设置完成此操作:
settings.Properties.AllowUserInput = false;