|
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.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
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
|
|
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.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,221
|
Hi,
To make a dialog visible from the server side, set the dialog's initialState to Visible.
Thanks
|
|