Help radRating in Repeater control

2 posts, 0 answers
  1. Robert
    Robert avatar
    3 posts
    Member since:
    Aug 2011

    Posted 11 Nov 2011 Link to this post

    I am using your 'rating & comment' example as the starting blocks for a ratings system I am building but I have hit a snag when using inside a repeater.

    Line 13:        function OnClientRated(controlRating, args) {
    Line 14:             var tooltip = $find("<%= RadToolTip1.ClientID %>");
    Line 15:   ;
    Line 16:         }

    My browser is telling me it cant find 'RadToolTip1' as it is within a repeater. How do I fix this? What do I need to change on the JS so it can see the radtooltip?

    Also, how do I get the values of the RadRating control (RadRating1) from within a repeater? Can I use OnItemCommand and pass in arguments and commnds???

    Many thanks
  2. Slav
    Slav avatar
    1359 posts

    Posted 15 Nov 2011 Link to this post

    Hi Simon,

    Note that when an ASP control is located inside a Repeater, accessing it isn't as straightforward as in a default scenario. If you want to reference the client object of the RadToolTip control, you will have to utilize additional client script in order to successfully find the control. Please find attached a sample page, implementing a possible solution for the scenario at hand.

    As for accessing the RadRating's value, you can handle the server event ItemDataBound and find the control in the Repeater's Item, as shown below:
    protected void myRepeaterUL_ItemDataBound(object sender, RepeaterItemEventArgs e)
        var rating = (RadRating)e.Item.FindControl("RadRating1");

    I hope that helps. Please let us know if you encounter additional difficulties.

    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Back to Top