3 Answers, 1 is accepted
0
Hello Sergio,
Please have in mind that the TreeList only supports inline and popup editing:
http://docs.telerik.com/kendo-ui/api/javascript/ui/treelist#configuration-editable.mode
I similar approach as the for the Grid can be set using kendo.validator:
http://demos.telerik.com/aspnet-mvc/grid/editing-custom-validation
Regards,
Stefan
Telerik by Progress
Please have in mind that the TreeList only supports inline and popup editing:
http://docs.telerik.com/kendo-ui/api/javascript/ui/treelist#configuration-editable.mode
I similar approach as the for the Grid can be set using kendo.validator:
http://demos.telerik.com/aspnet-mvc/grid/editing-custom-validation
Regards,
Stefan
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data (charts) and form elements.
0
dbCF
Top achievements
Rank 2
answered on 01 Aug 2018, 12:14 PM
Is this documented that one cannot rely on the model validation? I've also tried to mark the field as Nullable(false) in the model but without success.
Is custom validation the only way to go when using ASP.NET?
Best regards,
Carsten
0
Hello Carsten,
The TreeList supports model validation. The validation rules in the MVC TreeList are generated based on the data annotations in the edited model. For example, in the TreeList Editing demo, the edited model is declared like this (not visible in the online demo but you can open the demos solution locally on your computer and inspect it):
You can try deleting the FirstName or LastName value during editing in the demo or try to apply an Ext value bigger than 9999 and you will see the validation messages show up on blur.
Regards,
Tsvetina
Progress Telerik
The TreeList supports model validation. The validation rules in the MVC TreeList are generated based on the data annotations in the edited model. For example, in the TreeList Editing demo, the edited model is declared like this (not visible in the online demo but you can open the demos solution locally on your computer and inspect it):
public
class
EmployeeDirectoryModel
{
[ScaffoldColumn(
false
)]
public
int
EmployeeId {
get
;
set
; }
[Required]
[DisplayName(
"First name"
)]
public
string
FirstName {
get
;
set
; }
[Required]
[DisplayName(
"Last name"
)]
public
string
LastName {
get
;
set
; }
[ScaffoldColumn(
false
)]
public
int
? ReportsTo {
get
;
set
; }
public
string
Address {
get
;
set
; }
public
string
City {
get
;
set
; }
public
string
Country {
get
;
set
; }
public
string
Phone {
get
;
set
; }
[Required]
[Range(0, 9999)]
[DataType(
"Integer"
)]
public
int
? Extension {
get
;
set
; }
public
string
Position {
get
;
set
; }
private
DateTime? birthDate;
[DataType(DataType.Date)]
[DisplayName(
"Birthday"
)]
public
DateTime? BirthDate
{
get
{
return
birthDate;
}
set
{
if
(value.HasValue)
{
birthDate = value.Value;
}
else
{
birthDate =
null
;
}
}
}
private
DateTime? hireDate;
[DataType(DataType.Date)]
[DisplayName(
"Hire Date"
)]
public
DateTime? HireDate
{
get
{
return
hireDate;
}
set
{
if
(value.HasValue)
{
hireDate = value.Value;
}
else
{
hireDate =
null
;
}
}
}
You can try deleting the FirstName or LastName value during editing in the demo or try to apply an Ext value bigger than 9999 and you will see the validation messages show up on blur.
Regards,
Tsvetina
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.