Telerik is a leading vendor of ASP.NET AJAX, ASP.NET MVC, Silverlight, WinForms and WPF controls and components, as well as .NET Reporting, .NET ORM , .NET CMS, Code Analysis, Mocking, Team Productivity and Automated Testing Tools. Building on its expertise in interface development and Microsoft technologies, Telerik helps customers build applications with unparalleled richness, responsiveness and interactivity. Telerik products help thousands of companies to be more productive and deliver reliable applications under budget and on time.
Version Q2 2011 released 07/12/2011
select

Rating / Items Collection

Rating Bar

Pie Rating

Yes/No Rating

Rating: 0





  • Items Collection

    RadRating's Items Collection enables the user to indiviudally customzie every single item. By setting RadRatingItem's properties you can easily give diverse look and functionality to different items:

    • Value - the decimal value associated with the RadRatingItem.
    • ToolTip - the tooltip shown when the mouse pointer is hovered over the item.
    • CssClass - the CSS class applied to the item.
    • ImageUrl - the URL of the image displayed when item is not rated.
    • SelectedImageUrl - the URL of the image displayed when the item is selected (rated).
    • HoveredImageUrl - the URL of the image displayed when the item is not rated but the mouse pointer is over the item.
    • HoveredSelectedImageUrl - the URL of the image displayed when the item is selected (rated) and the mouse pointer is over the item.
    • ItemHeight(RadRating) - the height of every item. (The property is set to the RadRating control and not to the Item.)
    • ItemWidth (RadRating) - the width of every item. (The property is set to the RadRating control and not to the Item.)

Source Code

C# VB.NET
Show code in new window Demo isolation steps
  • <%@ Page Language="vb" AutoEventWireup="true" Inherits="Telerik.Web.Examples.Rating.ItemsCollection.DefaultVB"
        CodeFile="DefaultVB.aspx.vb" %>

    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
    <%@ Register TagPrefix="qsf" TagName="Header" Src="~/Common/Header.ascx" %>
    <%@ Register TagPrefix="qsf" TagName="HeadTag" Src="~/Common/HeadTag.ascx" %>
    <%@ Register TagPrefix="qsf" TagName="Footer" Src="~/Common/Footer.ascx" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <style type="text/css">
            .divBigRating, .divSmallRating
            {
                text-align: center;
                margin: 1.6em 0;
            }
            .divBigRating
            {
                width: 120px;
                height: 92px;
                background: url('Images/rating_back_big.png') no-repeat;
            }
            .divSmallRating
            {
                width: 120px;
                height: 37px;
                background: url('Images/rating_back_small.png') no-repeat;
            }
            .ratingClass, .ratingClass1, .ratingClass2
            {
                position: relative;
                top: 17px;
                text-align: left;
                margin: 0 auto;
                padding: 0;
            }
            .ratingClass1
            {
                top: 10px;
            }
            .ratingClass2
            {
                top: 7px;
            }
            #tableWrapper TR TD
            {
                width: 300px;
                height: 130px;
                padding-left: 50px;
            }
        </style>
        <qsf:HeadTag ID="Headtag1" runat="server" />
    </head>
    <body class="BODY">
        <form id="Form2" method="post" runat="server">
        <qsf:Header ID="Header1" runat="server" NavigationLanguage="VB" ShowSkinChooser="false" />
        <telerik:RadScriptManager ID="ScriptManager1" runat="server" />
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="ratingBinary" EventName="Rate">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="lblBinaryRating" UpdatePanelRenderMode="Inline" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <table id="tableWrapper">
            <tr>
                <td>
                    <qsf:InformationBox ID="ratingBar_InfoBox" runat="server" Title="Rating Bar">
                    </qsf:InformationBox>
                </td>
                <td>
                    <div class="divBigRating">
                        <telerik:RadRating ID="ratingBar" runat="server" Orientation="Horizontal" ItemHeight="61px"
                            ItemWidth="11px" CssClass="ratingClass">
                            <Items>
                                <telerik:RadRatingItem Value="1" HoveredImageUrl="Images/Rating1/1h.png" HoveredSelectedImageUrl="Images/Rating1/1h.png"
                                    SelectedImageUrl="Images/Rating1/1s.png" ImageUrl="Images/Rating1/1.png" ToolTip="Very Low" />
                                <telerik:RadRatingItem Value="2" HoveredImageUrl="Images/Rating1/2h.png" HoveredSelectedImageUrl="Images/Rating1/2h.png"
                                    SelectedImageUrl="Images/Rating1/2s.png" ImageUrl="Images/Rating1/2.png" ToolTip="Low" />
                                <telerik:RadRatingItem Value="3" HoveredImageUrl="Images/Rating1/3h.png" HoveredSelectedImageUrl="Images/Rating1/3h.png"
                                    SelectedImageUrl="Images/Rating1/3s.png" ImageUrl="Images/Rating1/3.png" ToolTip="Medium" />
                                <telerik:RadRatingItem Value="4" HoveredImageUrl="Images/Rating1/4h.png" HoveredSelectedImageUrl="Images/Rating1/4h.png"
                                    SelectedImageUrl="Images/Rating1/4s.png" ImageUrl="Images/Rating1/4.png" ToolTip="Medium-High" />
                                <telerik:RadRatingItem Value="5" HoveredImageUrl="Images/Rating1/5h.png" HoveredSelectedImageUrl="Images/Rating1/5h.png"
                                    SelectedImageUrl="Images/Rating1/5s.png" ImageUrl="Images/Rating1/5.png" ToolTip="High" />
                                <telerik:RadRatingItem Value="6" HoveredImageUrl="Images/Rating1/6h.png" HoveredSelectedImageUrl="Images/Rating1/6h.png"
                                    SelectedImageUrl="Images/Rating1/6s.png" ImageUrl="Images/Rating1/6.png" ToolTip="Very High" />
                            </Items>
                        </telerik:RadRating>
                    </div>
                </td>
            </tr>
            <tr>
                <td>
                    <qsf:InformationBox ID="ratingPie_InfoBox" runat="server" Title="Pie Rating">
                    </qsf:InformationBox>
                </td>
                <td>
                    <div class="divSmallRating">
                        <telerik:RadRating ID="ratingPie" runat="server" SelectionMode="Single" ItemHeight="20px"
                            ItemWidth="20px" CssClass="ratingClass2">
                            <Items>
                                <telerik:RadRatingItem Value="0" ToolTip="0%" HoveredImageUrl="Images/Rating3/1h.png"
                                    HoveredSelectedImageUrl="Images/Rating3/1h.png" SelectedImageUrl="Images/Rating3/1s.png"
                                    ImageUrl="Images/Rating3/1.png" />
                                <telerik:RadRatingItem Value="1" ToolTip="25%" HoveredImageUrl="Images/Rating3/2h.png"
                                    HoveredSelectedImageUrl="Images/Rating3/2h.png" SelectedImageUrl="Images/Rating3/2s.png"
                                    ImageUrl="Images/Rating3/2.png" />
                                <telerik:RadRatingItem Value="2" HoveredImageUrl="Images/Rating3/3h.png" HoveredSelectedImageUrl="Images/Rating3/3h.png"
                                    SelectedImageUrl="Images/Rating3/3s.png" ImageUrl="Images/Rating3/3.png" ToolTip="50%" />
                                <telerik:RadRatingItem Value="3" ToolTip="75%" HoveredImageUrl="Images/Rating3/4h.png"
                                    HoveredSelectedImageUrl="Images/Rating3/4h.png" SelectedImageUrl="Images/Rating3/4s.png"
                                    ImageUrl="Images/Rating3/4.png" />
                                <telerik:RadRatingItem Value="4" HoveredImageUrl="Images/Rating3/5h.png" HoveredSelectedImageUrl="Images/Rating3/5h.png"
                                    SelectedImageUrl="Images/Rating3/5s.png" ImageUrl="Images/Rating3/5.png" ToolTip="100%" />
                            </Items>
                        </telerik:RadRating>
                    </div>
                </td>
            </tr>
            <tr>
                <td>
                    <qsf:InformationBox ID="ratingBinary_InfoBox" runat="server" Title="Yes/No Rating">
                    </qsf:InformationBox>
                </td>
                <td>
                    <asp:Label ID="lblBinaryRating" runat="server" Font-Size="Medium"></asp:Label>
                    <div class="divSmallRating">
                        <telerik:RadRating ID="ratingBinary" runat="server" Orientation="Horizontal" SelectionMode="Single"
                            ItemHeight="20px" ItemWidth="20px" CssClass="ratingClass1" OnRate="ratingBinary_Rate"
                            AutoPostBack="true">
                            <Items>
                                <telerik:RadRatingItem Value="-1" HoveredImageUrl="Images/Rating2/downh.png" HoveredSelectedImageUrl="Images/Rating2/downh.png"
                                    SelectedImageUrl="Images/Rating2/downh.png" ImageUrl="Images/Rating2/down.png"
                                    ToolTip="No" />
                                <telerik:RadRatingItem Value="0" HoveredImageUrl="Images/Rating2/0h.png" HoveredSelectedImageUrl="Images/Rating2/0h.png"
                                    SelectedImageUrl="Images/Rating2/0.png" ImageUrl="Images/Rating2/0.png" ToolTip="Reset Current Rating" />
                                <telerik:RadRatingItem Value="1" HoveredImageUrl="Images/Rating2/uph.png" HoveredSelectedImageUrl="Images/Rating2/uph.png"
                                    SelectedImageUrl="Images/Rating2/uph.png" ImageUrl="Images/Rating2/up.png" ToolTip="Yes" />
                            </Items>
                        </telerik:RadRating>
                    </div>
                </td>
            </tr>
        </table>
        <br />
        <br />
        <br />
        <br />
        <qsf:Footer runat="server" ID="Footer1" ShowCodeViewer="true" />
        </form>
    </body>
    </html>

Get more than expected!

 
 

Take your time to truly experience the power of RadControls for ASP.NET AJAX with a free 60-day trial backed up by Telerik’s unlimited dedicated support.

Download your RadControls for ASP.NET AJAX trial and jumpstart your development with the available Getting Started resources.

If you have any questions, do not hesitate to contact us at sales@telerik.com.

Copyright 2002-2024 © Telerik. All right reserved
Telerik Inc, 201 Jones Rd, Waltham, MA 02451