This question is locked. New answers and comments are not allowed.
I have a grid with two string columns that are both "required"...
If I go to add a record, it will let me save changes with one of the columns omitted...
- Click "Add new record"
- Click "Save changes"
- Validation kicks in and tells me I need to enter a First Name... so I type one in, and click "Save changes"
- AJAX kicks in and tries to save the record (which fails, because there is no Last Name)
The validation works on the Last Name field, because if I click in and out without typing something, it will tell me:-
- Click "Add new record"
- Type in First Name
- Click in Last Name column, but click out again without entering anything
- Validation kicks in telling me I have to supply Last Name
A similar issue appears to have been reported here: http://www.telerik.com/community/forums/aspnet-mvc/grid/confused-with-model-validation-on-batch-editing.aspx
Thanks in advance for any help...
public class PersonModel{ [Display(Name = "First Name")] [Required(ErrorMessage = "First Name Required")] public string FirstName { get; set; } [Display(Name = "Last Name")] [Required(ErrorMessage = "Last Name Required")] public string LastName { get; set; }}@(Html.Telerik().Grid<PersonModel>() .Name("Grid") .ToolBar(commands => { commands.Insert(); commands.SubmitChanges(); }) .DataBinding(d => d .Ajax() .Select("AjaxSelect", "Person") .Update("AjaxUpdate", "Person") ) .ClientEvents(e => e .OnRowDataBound("GridOnRowDataBound") .OnEdit("GridOnEdit") .OnSave("GridOnSave") .OnError("GridOnError") ) .DataKeys(d => d.Add(o => o.Id)) .Editable(e => e.Mode(GridEditMode.InCell)) .Pageable() .Sortable() .Columns(columns => { columns.Bound(o => o.FirstName); columns.Bound(o => o.LastName); }))If I go to add a record, it will let me save changes with one of the columns omitted...
- Click "Add new record"
- Click "Save changes"
- Validation kicks in and tells me I need to enter a First Name... so I type one in, and click "Save changes"
- AJAX kicks in and tries to save the record (which fails, because there is no Last Name)
The validation works on the Last Name field, because if I click in and out without typing something, it will tell me:-
- Click "Add new record"
- Type in First Name
- Click in Last Name column, but click out again without entering anything
- Validation kicks in telling me I have to supply Last Name
A similar issue appears to have been reported here: http://www.telerik.com/community/forums/aspnet-mvc/grid/confused-with-model-validation-on-batch-editing.aspx
Thanks in advance for any help...