I'm trying to get a behavior equals the behavior when BindingValidationError is fired ...
I'm implementing the CellValidating event and when it is necessary (my business logic) I set the IsValid property to false and put my message into ErrorMessage property.
All works fine as is expected the cell appears with a red border and a error tooltip is created.But ... when I try put some string in a double field, the BindingValidationError is fired after CellValidating and before CellValidated, correctly ? So, the error tooltip appears without necessity to point the mouse hover the cell.
What I need is the same behavior in both situations. When my custom validation is executed or when an BindingException is thrown, in both cases I would like to show an error message without necessity to point the mouse there.
I tried to throw an exception in my cell validating implementation but I can't get the approach that I expected.
I'll attach an image ...
4 Answers, 1 is accepted
You may alter this behavior by editing the template of GridViewCell and predefining the UI validation logic in this template. The key part is to replace the validation tooltip template with a standard PopUp control, whose content appears when a cell enters in its Invalid State.
I have prepared an example for you that demonstrates this approach, feel free to customize it in the way you need.
Please let me know how this works for you.
the Telerik team
I tried use your solution making the validation into CellValidating event ... the tooltip (PopUp) appears as expected (it is not necessary to point the mouse) but the text that I put into ErroMessage isn't appearing ....
It works only if I use these interfaces that I mentioned before.
I'm making the validation in this method:
I'm sending a image with examples ...
A cell that is using the template you send-me, pop-up appears without a text.
A cell that is not using the template, the tooltip only appears if I put the mouse over there.
ps. I tried set the tooltip isopen to true in the same template that you edited ... but it crashed my app ....
I have spent some time to research this case and it seems that the ErrorMesssage property that we need to use is not directly accessible from this template. If you predefine the template of the GridViewEditorPresenter you will be able to see the predefined ErorMessage within RadGridView's CellValidating event, please use the sample below:
You may see the result at the attached picture. In a similiar way you may modify the appearance of this popup to directly match the default appearance of the GridViewCell's ValidationToolTip.
Please try the markup above and let me know how it works for you.
the Telerik team
I think I'm not able to edit this template I will appreciate if you could send me a sample solution.
Here I make the changes that you suggested me but now nothing is happing. I think that I made a mistake editing this template.
All what I've done was change my UserControlResource using the code that you showed in the last post. But it didn't works =/ ...
Thanks and sorry about the inconvenient and about my english ... I'm not a good speaker ...