Asp.net 隐藏剑道UI日期选择器文本框
我有一个应用程序,其中用户习惯于特定格式的日期,例如以下格式([]表示文本框): 每个组件都是一个单独的文本框,所以我要做的是使用KendoUIDateTimePicker,并通过选择上的JavaScript为我的自定义文本框设置一个值。我同意这一部分,但我不知道如何通过API在视图中隐藏输入文本框,以便只看到日期和时间按钮Asp.net 隐藏剑道UI日期选择器文本框,asp.net,asp.net-mvc,kendo-ui,kendo-datetimepicker,kendo-datepicker,Asp.net,Asp.net Mvc,Kendo Ui,Kendo Datetimepicker,Kendo Datepicker,我有一个应用程序,其中用户习惯于特定格式的日期,例如以下格式([]表示文本框): 每个组件都是一个单独的文本框,所以我要做的是使用KendoUIDateTimePicker,并通过选择上的JavaScript为我的自定义文本框设置一个值。我同意这一部分,但我不知道如何通过API在视图中隐藏输入文本框,以便只看到日期和时间按钮 有人知道怎么做吗?将“k-widget k-datepicker k-header”类的跨度宽度设置为0 编辑。这是我的方法,它正在发挥作用 @(Html.Kendo().
有人知道怎么做吗?将“k-widget k-datepicker k-header”类的跨度宽度设置为0 编辑。这是我的方法,它正在发挥作用
@(Html.Kendo().DatePickerFor(x => Model.Date)
.Name("date").HtmlAttributes(new { style = "width:0px;" })
.Events(e => e.Change("onChange")))
如果允许用户从KendoUI DateTimePicker选择日期,请尝试将格式定义为
“MMM dd yy HH tt”
:
这将使用您所需的格式设置选定日期的格式
要禁止用户键入,应执行以下操作:
$("#datepicker").kendoDateTimePicker({
format: "MMM dd yyyy HH tt"
});
$("#datepicker").attr("disabled", "disabled");
这不同于:
$("#datepicker").kendoDateTimePicker({
format: "MMM dd yyyy HH tt"
});
$("#datepicker").data("kendoDateTimePicker").enable(false);
因为这也会禁止使用按钮
在此处选中它:隐藏它的一种可能方法是将它放在一个宽度、高度为0px的空div下,并设置溢出;“隐藏” 还有一个单独的按钮,单击以编程方式打开日期选择器
<div style="width:0px; height:0px; overflow:hidden;">put datepicker control here</div>
将日期选择器控件放在此处
OK,这意味着它是一个javascript解决方案,这意味着您不能在插件初始化设置中指定它?
$("#datepicker").kendoDateTimePicker({
format: "MMM dd yyyy HH tt"
});
$("#datepicker").data("kendoDateTimePicker").enable(false);
<div style="width:0px; height:0px; overflow:hidden;">put datepicker control here</div>