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

how do i validate checked

2 Answers 164 Views
Button
This is a migrated thread and some comments may be shown as answers.
moegal
Top achievements
Rank 1
moegal asked on 15 Jan 2013, 03:44 PM
How would I validate checked for a radbutton with ToggleType="CheckBox"

I have one checkbox( ToggleType="CheckBox") and then a regular radbutton(ButtonType="StandardButton") to proceed.

I am using this for "Accept Terms"

Thanks, Marty

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 16 Jan 2013, 04:00 AM
Hi,

I suppose you want to validate a RadButton. Following is the sample code.

ASPX:
<telerik:RadButton ID="RadButton1" runat="server" Text="btn" ButtonType="ToggleButton" ToggleType="CheckBox">
</telerik:RadButton>
<asp:CustomValidator ErrorMessage="RadButton1 is not checked" ID="CustomValidator" runat="server" ClientValidationFunction="Validation">
</asp:CustomValidator>
<telerik:RadButton ID="RadButton2" runat="server" Text="val" ButtonType="StandardButton">
</telerik:RadButton>

JS:
<script type="text/javascript">
    function Validation(sender, args) {
        debugger;
        var RadButton1 = $find("<%=RadButton1.ClientID %>");
        if (RadButton1.get_checked() == true) {
            alert("RadButton1 is checked");
            args.IsValid = true;
        }
        else {
            alert("RadButton1 is not checked");
            args.IsValid = false;
        }
    }
</script>

Regards,
Princy.
0
moegal
Top achievements
Rank 1
answered on 17 Jan 2013, 11:23 AM
Princy,

thanks.  I will try this today!

Marty
Tags
Button
Asked by
moegal
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
moegal
Top achievements
Rank 1
Share this question
or