DevExpress - Gridview return FormCollection 格式错误
DevExpress - Gridview return FormCollection bad format
我使用 gridview 和动态生成列。我有列 TimeEdit
settings.Columns.Add(s =>
{
s.FieldName = item.DescriptionType;
s.Name = item.DescriptionType;
s.Caption = item.DescriptionType;
if(item.FormatType == (int)SoftInputDateNum.TimeWithDate)
{
s.PropertiesEdit.DisplayFormatString = WebApp.Models.TransportDynamicLogic.GetFormatType(item.Type, item.FormatType);
s.ColumnType = MVCxGridViewColumnType.DateEdit;
var properties = s.PropertiesEdit as DateEditProperties;
properties.ValidationSettings.RequiredField.IsRequired = true;
properties.EditFormat = EditFormat.Custom;
properties.EditFormatString = WebApp.Models.TransportDynamicLogic.GetFormatType(item.Type, item.FormatType);
}
}
和我 return 所有 collection 形式。
public ActionResult AddForm(FormCollection table)
{
//SomeLogic
var date = table["Date"];
}
我只得到格式 "new(2015,2,3)",但我想要格式“3.2.2015”,因为我设置了 DisplayFormatString = "dd.MM.yyyy".
我解决了
如果你想显示正确的日期,你需要日期时间变量。没有像我一样的字符串。
我使用 gridview 和动态生成列。我有列 TimeEdit
settings.Columns.Add(s =>
{
s.FieldName = item.DescriptionType;
s.Name = item.DescriptionType;
s.Caption = item.DescriptionType;
if(item.FormatType == (int)SoftInputDateNum.TimeWithDate)
{
s.PropertiesEdit.DisplayFormatString = WebApp.Models.TransportDynamicLogic.GetFormatType(item.Type, item.FormatType);
s.ColumnType = MVCxGridViewColumnType.DateEdit;
var properties = s.PropertiesEdit as DateEditProperties;
properties.ValidationSettings.RequiredField.IsRequired = true;
properties.EditFormat = EditFormat.Custom;
properties.EditFormatString = WebApp.Models.TransportDynamicLogic.GetFormatType(item.Type, item.FormatType);
}
}
和我 return 所有 collection 形式。
public ActionResult AddForm(FormCollection table)
{
//SomeLogic
var date = table["Date"];
}
我只得到格式 "new(2015,2,3)",但我想要格式“3.2.2015”,因为我设置了 DisplayFormatString = "dd.MM.yyyy".
我解决了
如果你想显示正确的日期,你需要日期时间变量。没有像我一样的字符串。