Hello,
I have a Grid whose editmode="forms". I am doing some server-side validation on the item Insert and Update events. I am not using a "DataSource", but instead binding directly to a collection of objects. What I am having trouble with is that if the inserted/updated item is not valid, I want to keep that row in edit view. My code for the Update event is as follows:
| void OnPartAliasesUpdateCommand(object source, GridCommandEventArgs e) |
| { |
| GridEditableItem item = e.Item as GridEditableItem; |
| string partCode = item.OwnerTableView.DataKeyValues[item.ItemIndex]["PartAlias"].ToString(); |
| App.Core.BusinessObjects.Part partAlias = PartAliases[partCode]; |
| RetrievePartAliasForm(item, partAlias); |
| if (!ValidatePartAliasForm(partAlias)) |
| { |
| ccPartAliasStatusLabel.AddErrors(base.Rules); |
| return; |
| } |
| PartAliases[partAlias.PartAlias] = partAlias; |
| rdgPartAliases.Rebind(); |
| } |
In other words, if the call to ValidatePartAliasForm return false, keep the item in edit view. Any help would be appreciated.
Thanks!