Hi Guys,
First of all, here's my grid definition
My validation issue is that, on create, if I try to save without selecting a value for UOM_ID, I get the "The field Measure Unit must be a number." error.
Here is the data annotation related to this field
How come that validation doesn't succeed when the dafault value for that field is null (as defined inside grid's model) and the model's field is Nullable??
My Goal here is to build a custom creation process...I'd like to set the measure unit only if the value choosen from the first field (attributeID - rendered as a combo) is of a certain type...
Is it possible?
Thanks
Fabio
First of all, here's my grid definition
@(Html.Kendo().Grid<DATACLASS_ATTRIBUTES_T012>()
.Name(
"Grid"
)
.ToolBar(commands => { commands.Create().Text(
"New Attribute"
); })
.Columns(columns =>
{
columns.ForeignKey(
"ATTRIBUTEID"
, ViewBag.Attributes).ClientTemplate(
"#: data.DC_ATTRIBUTES_T006 ? DC_ATTRIBUTES_T006.NAME : 'none'#"
).Width(270);
columns.Command(command => { command.Edit().UpdateText(
"Save"
); }).Width(173);
})
.Pageable()
.Sortable()
.Scrollable()
.Filterable()
.Editable(mode => mode.Mode(GridEditMode.InLine))
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(5)
.ServerOperation(
false
)
.Model(model =>
{
model.Id(v => v.ID);
model.Field(v => v.ATTRIBUTEID).DefaultValue(1);
model.Field(v => v.UOM_ID).DefaultValue(
null
);
model.Field(v => v.DATACLASS_ID).DefaultValue(Model.ID);
})
.Read(r => r.Action(
"GetAttributeByDataClass/"
+ Model.ID,
"Attribute"
))
.Update(r => r.Action(
"UpdateDataClassAttribute"
,
"Attribute"
))
.Create(r => r.Action(
"CreateDataClassAttribute"
,
"Attribute"
))
)
)
My validation issue is that, on create, if I try to save without selecting a value for UOM_ID, I get the "The field Measure Unit must be a number." error.
Here is the data annotation related to this field
[UIHint(
"MeasureUnitEditor"
)]
[Display(Name =
"Measure Unit"
)]
public
Nullable<
int
> UOM_ID;
How come that validation doesn't succeed when the dafault value for that field is null (as defined inside grid's model) and the model's field is Nullable??
My Goal here is to build a custom creation process...I'd like to set the measure unit only if the value choosen from the first field (attributeID - rendered as a combo) is of a certain type...
Is it possible?
Thanks
Fabio