Welcome Guest Search | Active Topics | Sign In | Register

Grid validation Options
Philip
Posted: Thursday, June 12, 2008 4:34:02 AM
Rank: Newbie
Groups: Member

Joined: 4/7/2008
Posts: 2
How do I validate the data in my Grid?

I do not appear to be able to use the easiest method of attaching MaskedEditValidators to my MaskedEdit objects.

I'm looping around my AddedItems and ChangedItems arrays, but how do I get to the MaskedEdit.IsValid property? How then can I display a model dialog server side.

I have a dialog on the page but making it visible appears to have no effect.Eh?
eo_support
Posted: Thursday, June 12, 2008 10:56:38 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

You will not be able to validate the MaskedEdit directly with a validator because the MaskedEdit control is created by the Grid thus is not accessible to outside code.

Since you can have multiple values with your AddedItems and ChangedItems, you will have to check IsValid on each of these values. The easiest way is to use a separate MaskedEdit control and do something like this:

Code: C#
private bool IsValueValid(string s)
{
    MaskedEdit1.Text = s;
    return MaskedEdit1.IsValid;
}


You may want to put this second MaskedEdit inside a hidden div so that it's visible to your user.

Hope this helps.

Thanks
Philip
Posted: Friday, June 13, 2008 2:35:16 AM
Rank: Newbie
Groups: Member

Joined: 4/7/2008
Posts: 2
OK, I can see how that would work. How would you echo any invalid warnings back to the user? I thought of using a dialog box, but I don't seem to be able to make one visible - from server side. The demos all use client side javascript.
eo_support
Posted: Friday, June 13, 2008 8:54:25 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

To make a dialog visible from the server side, set the dialog's initialState to Visible.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.