Michael Foster
Michael Foster

Reputation: 356

RadGrid batch edit original value blank validation exception

I have a RadGrid using BatchEdit mode. The automated validation is working fine, but I want to program in an exception: blank values are not allowed for fields, but the database is full of records with existing blank values. I want the validation to accept a blank value if the existing record already has a blank value.

Here is my validation method. Note that the attribute OriginalValue doesn't exist; it's part of my trying to find the original value, but adding it turned out to be problematic.

        function BlankFieldValidator(sender, args) {
            if (args.Value.length == 0) {
                if (sender.getAttribute("OriginalValue").length != 0) {
                    args.IsValid = false;
                }
            }
        }

In debugging the page, I can examine the sender and args objects, but I see nothing that contains the original value in it. I conclude it must be in the Telerik data structure somewhere, since one can still click Cancel Changes to revert all changes to the RadGrid.

What is a good method for retrieving the original value to compare to the edited value?

Upvotes: 1

Views: 72

Answers (0)

Related Questions