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

validate radrating

1 Answer 87 Views
Rating
This is a migrated thread and some comments may be shown as answers.
Sigma
Top achievements
Rank 1
Sigma asked on 26 Nov 2012, 09:35 AM
I have a radrating in my form. I want to validate whether the rating is checked using a customvalidator. Please help me to achieve this scenario.

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 26 Nov 2012, 09:54 AM
Hi Sigma,

Try the following code snippet to achieve your scenario.

ASPX:
<telerik:RadRating ID="RadRating1" runat="server">
</telerik:RadRating>
<asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="Please rate"
    ControlToValidate="RadRating1" OnServerValidate="CustomValidator1_ServerValidate"
    ForeColor="Red">
</asp:CustomValidator>
<br />
<telerik:RadButton ID="RadButton1" runat="server" Text="RadButton">
</telerik:RadButton>

C#:
protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
{
    args.IsValid = (Int32.Parse(args.Value) > 0);
}

Please take a look into this documentation for more information.

Regards,
Princy.
Tags
Rating
Asked by
Sigma
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or