Associate Unique ID's for each 'star'

2 posts, 0 answers
  1. Ben Slater
    Ben Slater avatar
    3 posts
    Member since:
    Nov 2009

    Posted 31 Jan 2010 Link to this post

    Is there any way to achieve this?

    Example: I have a RadRating control with an ItemCount of 5, I would like to have each item within the Rating control to have its own unique identifier.

    ie. 'RadRating1 1', 'RadRating1 2', 'RadRating1 3', 'RadRating1 4', 'RadRating1 5'

    I started digging and would assume to achieve this functionality I would have to modify the RadRating .js? If so, how?


    Edit: Thinking about it a bit more, I'd need the classes to have it's own number. Please see the example below. I have altered the HTML render to how I would like it, primarily the A tag's class and ID.

    <div class="RadRating RadRating_Test" id="ctl00_ContentPlaceHolder1_rptLatestOffers_ctl02_RadRating1" style="width: 89px; float: left; height: 22px;" RowID="2" WineID="2432" control="[object Object]">  
      <ul class="rrtItem" _events="[object Object]">  
        <li class="rrtSelected">  
          <title="1" class="1" id="1" href="#"></a> 
        <li class="rrtSelected">  
          <title="2" class="2" id="2" href="#"></a> 
        <li class="rrtSelected">  
          <title="3" class="3" id="3" href="#"></a> 
        <li class="rrtSelected">  
          <title="4" class="4" id="4" href="#"></a> 
        <li class="rrtSelected">  
          <title="5" class="5" id="5" href="#"></a> 

  2. Tsvetie
    Tsvetie avatar
    1517 posts

    Posted 04 Feb 2010 Link to this post

    Hello Ben Slater,
    You can set an id and class attribute for the items of the rating control the following way:
    <telerik:RadRating ID="RadRating2" runat="server" Precision="Item" ItemCount="5"
    <script type="text/javascript">
        function OnClientLoad(sender,args)
            var aElements = sender.get_element().getElementsByTagName("A");
            for (var i = 0,length = aElements.length;i < length;i++)
                var element = aElements[i];
       = "element" + (i + 1);
                Sys.UI.DomElement.addCssClass(element,"class" + (i + 1));

    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
Back to Top