Kendo ui 这是剑道UI模型dataannotation中的一个错误:网格单元编辑中的错误提示
我定义了名为Kendo ui 这是剑道UI模型dataannotation中的一个错误:网格单元编辑中的错误提示,kendo-ui,kendo-grid,kendo-asp.net-mvc,Kendo Ui,Kendo Grid,Kendo Asp.net Mvc,我定义了名为StockDataPoint的viewmodel,并像这样查看,在viewmodel中,我限制颜色的长度为5。在网格中,如果我编辑颜色,例如输入长度大于5的字符串“green1”,网格显示长度不超过5,但当我输入“green”时,应该可以,但是网格仍然显示长度不超过5。我已经更新了新版本,例如kendo.all.min.js,jquery.min.js,但它仍然不工作。项目是,图片是 视图模型:StockDataPoint public class StockDataPoint {
StockDataPoint
的viewmodel,并像这样查看,在viewmodel中,我限制颜色的长度为5。在网格中,如果我编辑颜色,例如输入长度大于5的字符串“green1”,网格显示长度不超过5
,但当我输入“green”时,应该可以,但是网格仍然显示长度不超过5
。我已经更新了新版本,例如kendo.all.min.js,jquery.min.js
,但它仍然不工作。项目是,图片是
视图模型:StockDataPoint
public class StockDataPoint
{
public DateTime Date { get; set; }
[StringLength(5, ErrorMessage = "length no more than 5")]
public string Color { get; set; }
public double Close { get; set; }
public int Volume { get; set; }
public double Open { get; set; }
public double High { get; set; }
public double Low { get; set; }
public string Symbol { get; set; }
}
@(Html.Kendo().Grid<ChartServerGrouping.Models.StockDataPoint>()
.Name("DataGrid")
.Editable(editable => editable.Mode(GridEditMode.InLine))
.Columns(columns =>
{
columns.Bound(p => p.Close).Groupable(false).Title("Close").Width(120);
columns.Bound(p => p.Color).Groupable(false).Title("Color").Width(120);
columns.Command(command =>
{
command.Edit().UpdateText("Save");
}).Width(160); })
.Selectable(selectable => selectable.Type(GridSelectionType.Cell))
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("GetData", "Home"))
.Update(read => read.Action("GetData", "Home"))
.Model(model => model.Id(p => p.Date))
)
.AutoBind(true)
.Resizable(resize => resize.Columns(true)))
查看:显示和编辑数据的网格
public class StockDataPoint
{
public DateTime Date { get; set; }
[StringLength(5, ErrorMessage = "length no more than 5")]
public string Color { get; set; }
public double Close { get; set; }
public int Volume { get; set; }
public double Open { get; set; }
public double High { get; set; }
public double Low { get; set; }
public string Symbol { get; set; }
}
@(Html.Kendo().Grid<ChartServerGrouping.Models.StockDataPoint>()
.Name("DataGrid")
.Editable(editable => editable.Mode(GridEditMode.InLine))
.Columns(columns =>
{
columns.Bound(p => p.Close).Groupable(false).Title("Close").Width(120);
columns.Bound(p => p.Color).Groupable(false).Title("Color").Width(120);
columns.Command(command =>
{
command.Edit().UpdateText("Save");
}).Width(160); })
.Selectable(selectable => selectable.Type(GridSelectionType.Cell))
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("GetData", "Home"))
.Update(read => read.Action("GetData", "Home"))
.Model(model => model.Id(p => p.Date))
)
.AutoBind(true)
.Resizable(resize => resize.Columns(true)))
@(Html.Kendo().Grid())
.Name(“数据网格”)
.Editable(可编辑=>Editable.Mode(GridEditMode.InLine))
.列(列=>
{
columns.Bound(p=>p.Close).Groupable(false).Title(“Close”).Width(120);
columns.Bound(p=>p.Color).Groupable(false).Title(“Color”).Width(120);
columns.Command(Command=>
{
command.Edit().UpdateText(“保存”);
}).宽度(160);})
.Selectable(可选=>Selectable.Type(GridSelectionType.Cell))
.DataSource(DataSource=>DataSource
.Ajax()
.Read(Read=>Read.Action(“GetData”,“Home”))
.Update(read=>read.Action(“GetData”,“Home”))
.Model(Model=>Model.Id(p=>p.Date))
)
.AutoBind(真)
.resize可调整大小(resize=>resize.Columns(true)))
是的,在官方网站上它是一个。如果你像这样编辑:绿色-->绿色1-->蓝色,消息会消失吗?是的,它会消失。但是如果我像这样输入“绿色-->绿色1--->绿色”,它不会消失。好的,这是一个与数据验证程序相关的错误,我已经回答了。