how do i validate checked

3 posts, 0 answers
  1. moegal
    moegal avatar
    273 posts
    Member since:
    Jul 2007

    Posted 15 Jan 2013 Link to this post

    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. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 15 Jan 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. moegal
    moegal avatar
    273 posts
    Member since:
    Jul 2007

    Posted 17 Jan 2013 Link to this post

    Princy,

    thanks.  I will try this today!

    Marty
Back to Top