This is a migrated thread and some comments may be shown as answers.

CustomValidator - Validate 2 control - Popup Form

1 Answer 65 Views
Grid
This is a migrated thread and some comments may be shown as answers.
mSchmidt
Top achievements
Rank 1
mSchmidt asked on 07 Oct 2008, 06:04 PM
Hi iam trying to create a CustomValidator which should validate 2 fields within a RadGrids Popup edit window.

Here is the Custom Validator
<asp:CustomValidator runat="server" ErrorMessage="Indtast en pris"   
                        Display="Dynamic"  onservervalidate="Unnamed1_ServerValidate"></asp:CustomValidator> 

And the method bound to it:
 protected void Unnamed1_ServerValidate(object source, ServerValidateEventArgs args)  
 


However the problem is i cant seem to get references to the controls which i want to validate.
How do i get references to the controls which are in the popup window ?

1 Answer, 1 is accepted

Sort by
0
mSchmidt
Top achievements
Rank 1
answered on 08 Oct 2008, 09:30 PM
Solved it my self

            RadNumericTextBox stndPris = ((Control)source).FindControl("IngrDec1"as RadNumericTextBox;  
            RadNumericTextBox kostPris = ((Control)source).FindControl("IngrDec2"as RadNumericTextBox;  
            if (stndPris.Value.HasValue || kostPris.Value.HasValue )  
            {  
                args.IsValid = true;  
            }  
            else 
            {  
                args.IsValid = false;  
            } 
Tags
Grid
Asked by
mSchmidt
Top achievements
Rank 1
Answers by
mSchmidt
Top achievements
Rank 1
Share this question
or