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

Validation

1 Answer 97 Views
Rating
This is a migrated thread and some comments may be shown as answers.
Allen
Top achievements
Rank 2
Allen asked on 06 May 2010, 07:56 AM
I am trying to use a standard asp:RequiredFieldValidator with the control, but keep getting an error message "Control [rating] referenced by the ControlToValidate property of  [validator] cannot be validated."  I have other validators on the form that work fine.  Can this type of control not be validated this way?

Thanks.

1 Answer, 1 is accepted

Sort by
0
Tsvetie
Telerik team
answered on 10 May 2010, 10:21 AM
Hi Allen,
Yes, you are correct - currently the rating control cannot be validated with a RequiredFieldValidator control. You can use a CustomValidator control instead. For example:
<script type="text/javascript">
    function ClientValidate(source,arguments)
    {
        var ratingValue = $find("<%= RadRating1.ClientID %>").get_value();
        if (ratingValue == 0)
        {
            arguments.IsValid = false;
        } else
        {
            arguments.IsValid = true;
        }
    }
 
</script>
<telerik:RadRating ID="RadRating1" runat="server">
</telerik:RadRating>
<asp:CustomValidator ID="CustomValidator1" runat="server" ClientValidationFunction="ClientValidate"
    Display="Static" ErrorMessage="Please rate!"></asp:CustomValidator>
<asp:Button ID="Button1" runat="server" Text="Postback" />

Sincerely yours,
Tsvetie
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Rating
Asked by
Allen
Top achievements
Rank 2
Answers by
Tsvetie
Telerik team
Share this question
or