当网格进入编辑模式时,DateTime选择器清除值(When grid enters edit mode DateTime picker clears value)
我有一个绑定到网格的DateTime字段。 当网格进入编辑模式时,将显示日期/时间选择器,但会从中清除该值。 这会强制用户重新输入日期/时间。 知道为什么在触发编辑模式时清除它的值?
@(Html.Telerik().Grid<ExpenseGridModel>() .DataBinding(dataBinding => dataBinding.Ajax() .Select("ExpenseAjaxBinding", "ExpenseEntry") .Update("ExpenseUpdate", "ExpenseEntry") ) .Name("ExpensesGrid") .DataKeys(keys => keys.Add(r => r.id)) .Columns(columns => { columns.ForeignKey(o => o.categoryId, Model.expenseCategories, "Id", "Name"); columns.ForeignKey(o => o.typeId, Model.expenseTypes, "Id", "Name"); columns.Bound(r => r.date); columns.ForeignKey(o => o.classId, Model.expenseClasses, "Id", "Name"); columns.Bound(r => r.description); columns.Bound(r => r.amount); columns.Command(commands => commands.Edit() ); }) )I have a DateTime field bound to a grid. When the grid enters edit mode the date/time picker displays, but the value is cleared from it. This forces the user to re enter the date/time. Any idea why it value is cleared when the edit mode is triggered?
@(Html.Telerik().Grid<ExpenseGridModel>() .DataBinding(dataBinding => dataBinding.Ajax() .Select("ExpenseAjaxBinding", "ExpenseEntry") .Update("ExpenseUpdate", "ExpenseEntry") ) .Name("ExpensesGrid") .DataKeys(keys => keys.Add(r => r.id)) .Columns(columns => { columns.ForeignKey(o => o.categoryId, Model.expenseCategories, "Id", "Name"); columns.ForeignKey(o => o.typeId, Model.expenseTypes, "Id", "Name"); columns.Bound(r => r.date); columns.ForeignKey(o => o.classId, Model.expenseClasses, "Id", "Name"); columns.Bound(r => r.description); columns.Bound(r => r.amount); columns.Command(commands => commands.Edit() ); }) )最满意答案
我通过设置编辑器模板来解决问题。 默认情况下,它使用DateTime Picker。 幸运的是,我不需要TimePicker部分。
columns.Bound(r => r.date).Format("{0:d}").EditorTemplateName("Date");I fixed the issue by setting the editor template. By default it was using the DateTime Picker. Fortunately I didn't need the TimePicker portion.
columns.Bound(r => r.date).Format("{0:d}").EditorTemplateName("Date");更多推荐
Name,date,columns,电脑培训,计算机培训,IT培训"/> <meta name="description
发布评论