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

Using RadInputManager To Compare Two TextBox Controls

1 Answer 86 Views
Input
This is a migrated thread and some comments may be shown as answers.
Troy
Top achievements
Rank 1
Troy asked on 02 Sep 2011, 06:59 PM
Does anyone know if it's possible to use the RadInputManager to compare two TextBox controls the way a CompareValidator control does? I like having the warning icons in my TextBox controls and when I use the CompareValidator control, I don't get them when two TextBox's text properties are different.

1 Answer, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 07 Sep 2011, 03:18 PM
Hi Troy,


You could use the client OnValidating event of the textbox settings to perform a comparison between the two textboxes and set the textbox value as invalid if they are different (eventArgs.set_isValid(false)).
<telerik:RadInputManager runat="server">
    <telerik:TextBoxSetting ClientEvents-OnValidating="validating">
        <TargetControls>
            <telerik:TargetInput ControlID="txt" />
        </TargetControls>
    </telerik:TextBoxSetting>
</telerik:RadInputManager>

<script type="text/javascript">
    function validating(sender, eventArgs) {
        if(....) {
            eventArgs.set_isValid(false);
        }                    
    }
</script>

Kind regards,
Tsvetina
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
Input
Asked by
Troy
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Share this question
or