MiddleTommy
Top achievements
Rank 1
MiddleTommy
asked on 24 May 2010, 06:17 PM
I am doing an async validation when a property is changed. the validation happens but it is not reflected in the UI until the cell being validated is selected again after the async validation occurs. is there a way for the grid to keep track of the ValidationErrors collection in the Entity to update the UI? This is a SL 4 application
4 Answers, 1 is accepted
0
MiddleTommy
Top achievements
Rank 1
answered on 25 May 2010, 07:01 PM
I read somewhere that Async DataValidation is not supported so I tried some things.
What I came up with was in the partial method of the ria services entity where the property is changed I add an error to the ValidationsErrors collection. Then when the property async passes validation I remove that error from the ValidationErrors collection.
Or if it fails I change the Error to be something else
It works for me.
the query I call is labeled with the invoke attribute in the DomainService
What I came up with was in the partial method of the ria services entity where the property is changed I add an error to the ValidationsErrors collection. Then when the property async passes validation I remove that error from the ValidationErrors collection.
Or if it fails I change the Error to be something else
It works for me.
private MyCardsContext _vctx; |
private MyCardsContext vctx |
{ |
get |
{ |
if (_vctx == null) |
{ |
_vctx = new MyCardsContext(); |
} |
return _vctx; |
} |
} |
private ValidationResult mtypeError; |
partial void OntypeChanged() |
{ |
var value = type; |
if(IsDeserializing) |
return; |
if(!value.IsEmpty()) |
{ |
mtypeError = new ValidationResult("Type is being checked", new[] { "type" }); |
ValidationErrors.Add(mtypeError); |
vctx.FindMType(this.type, delegate(InvokeOperation<MType> io) |
{ |
var mtype = io.Value; |
if (mtype == null) |
{ |
ValidationErrors.Remove(mtypeError); |
mtypeError = new ValidationResult("type is invalid", new[] { "type" }); |
ValidationErrors.Add(mtypeError); |
MType = null; |
} |
else |
{ |
ValidationErrors.Remove(mtypeError); |
this.MType = mtype; |
} |
}, null); |
} |
else |
MType = null; |
} |
the query I call is labeled with the invoke attribute in the DomainService
[Invoke] |
public MType FindMType(string alias) |
{ |
var type = alias; |
var aliases = GetMTypeAliases(); |
var mt = from t in aliases |
where t.type == type |
select t.MType; |
//var mtypes = GetMTypes(); |
//var mt = from t in mtypes |
// where (from m in t.MTypeAliases where m.type == type select m.MTypeId).Contains(t.Id) |
// select t; |
return mt.FirstOrDefault(); |
} |
0
Hello,
We will do our best to include support for async validation unfortunately this will be most probably after Q2 2010 release - probably Sp1.
Kind regards,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
We will do our best to include support for async validation unfortunately this will be most probably after Q2 2010 release - probably Sp1.
Kind regards,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
MiddleTommy
Top achievements
Rank 1
answered on 27 May 2010, 03:58 PM
In the mean time is there an example or way to show cells with errors that are not being edited?
Say for instance you have a cell that when edited throws another cell in error.
Say for instance you have a cell that when edited throws another cell in error.
0
Hi TWT,
I'm attaching a sample project that can give you an idea how to achieve this.
Important code is inside PersonValidator class (which handles data layer validation on a row level). Code inside RadGridView.RowValidated event handler just puts incorrect cell into edit mode.
I hope this will help.
Kind regards,
Nedyalko Nikolov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
I'm attaching a sample project that can give you an idea how to achieve this.
Important code is inside PersonValidator class (which handles data layer validation on a row level). Code inside RadGridView.RowValidated event handler just puts incorrect cell into edit mode.
I hope this will help.
Kind regards,
Nedyalko Nikolov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.