| RadControls version |
2009 Q3 and later
|
| .NET version |
Any
|
| Visual Studio version |
Any
|
| programming language |
C#
|
| browser support |
all browsers supported by RadControls
|
I've seen the question "Can I show a validation summary in a RadWindow" a number of times in the forums; I asked it myself. There have been a number of responses which kind of do the job but never well enough for my to want to use 'em.
Looking through the telerik demos recently (no, I don't get out much) I noticed the "RadWindow as a Controls Container" demo and developed the following solution to the validation summary question.
Before I start let me say that this only works with the CustomValidator class.
Consider a case were I need to validate that the value in a textbox begins with, say, an "A" (trivial enough for you?). We'd start with something like this...
To get the summary in a RadWindow, change it to looke like this ...
Basically, that's it. You can play to your heart's content from here. You can add other controls to the window, like a button to dismiss it, you can make it modal, whatever.
There is a bit of a gotcha here however; as written above, a CustomValidator won't fire if your input is blank. You prolly know this, but did you know that it will /always/ fire if you don't include the ControlToValidate attribute? All that means is that you have to explicitly get the control you want to validate in your client-side code, like this...
If you find a way of making this technique work with other validator types, or just find a better way of doing this, why not post here and let us all know?
--
Stuart