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

Help radRating in Repeater control

1 Answer 103 Views
Rating
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 11 Nov 2011, 04:11 PM
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:             tooltip.show();
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
Simon

1 Answer, 1 is accepted

Sort by
0
Slav
Telerik team
answered on 15 Nov 2011, 11:11 AM
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.

Regards,
Slav
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
Tags
Rating
Asked by
Robert
Top achievements
Rank 1
Answers by
Slav
Telerik team
Share this question
or