Yes,in the official web it is a bug.
That is a bug in Kendo UI model dataannotation:the wrong tips in grid cell edit
-
09-07-2023 - |
Question
I define my viewmodel called StockDataPoint
and view like this,in the viewmodel I limit that the color's length is 5.In the grid,if I edit the color such as input the string 'green1' which length is larger than 5,and the grid show length no more than 5
,but when I input the 'green',it should be OK,but the grid still show length no more than 5
.I have update the new version such as kendo.all.min.js,jquery.min.js
,but it still not work.THe project is here,and the picture is here
ViewModel: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; }
}
View:grid to show and edit data
@(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)))
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow