Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Bobby 43 posts 63 karma points
    Oct 18, 2011 @ 08:57
    Bobby
    0

    Star rating Component

    Hi,

    I am using Umbraco 4.5.2 and .Net framework 3.5, I have a situtation in which i need to use a star rating component in my project.i have several memebers in my project and  I need to create several datatypes for each member  with the star rating control and need to give rating to each member and i need to displa them on the webpage.

    Can anyone help me how can i acehive this.

     

    Thanks

    Bobby 

     

  • Dirk De Grave 4534 posts 5982 karma points MVP 3x admin c-trib
    Oct 18, 2011 @ 09:08
    Dirk De Grave
    0

    Hi,

    Do you want a star rating dataype for use in the admin backend? Or just have a star rating functionality on the frontend? For the latter, you may find some interesting jquery implementations on the interweb.

     

    Cheers,

    /Dirk

  • Bobby 43 posts 63 karma points
    Oct 18, 2011 @ 13:39
    Bobby
    0

    Hi drik,

    I want to use a star rating datatype.

    Thanks 

    Bobby

  • Anthony pj 40 posts 63 karma points
    Oct 19, 2011 @ 02:25
    Anthony pj
    0

    Hi Bobby

    Not saying this is the perfect solution but from i understand you are trying to do i came up with this solution , you will have to adjust to your needs but might give you a starting point ...i runnign in .net framework 4 and umbraco 4.7.1

    First

    I created VS project in which i created two usercontrols

     1. A simple dropdownlist control for rating 1-5

                     Ratingcontrol.ascx

                         <asp:DropDownList ID="dp_ratings" runat="server" >
                              <asp:ListItem Text="Please choose..." Value="0"></asp:ListItem>
                             <asp:ListItem Text="1" Value="1"></asp:ListItem>
                              <asp:ListItem Text="2" Value="2"></asp:ListItem>
                             <asp:ListItem Text="3" Value="3"></asp:ListItem>
                            <asp:ListItem Text="4" Value="4"></asp:ListItem>
                            <asp:ListItem Text="5" Value="5"></asp:ListItem>
                         </asp:DropDownList>

                    RatingControl.ascx.cs

                          using System;
                          using System.Web.UI.WebControls;
                          using umbraco.editorControls.userControlGrapper;

                          public partial class Ratings : System.Web.UI.UserControl, IUsercontrolDataEditor
                            {
           
                            public object value
                                    {
                                        get { return dp_ratings.SelectedValue; }
                                        set { dp_ratings.SelectedValue = value.ToString(); }
                                     }

                             }

     2. A repeater control to list out Members and properties.

               MemberList.ascx

                 Member List

               <asp:Repeater ID="rp_membersList" runat="server">
                  <ItemTemplate>
                      <div class="border">
                               Member Name: <%# ((dynamic) Container.DataItem).LoginName %>
                               <br />                      
                             Rating:
                             <div class='rating-<%# ((dynamic) Container.DataItem).getProperty("rateMember").Value %>'>
                                          <%# ((dynamic)Container.DataItem).getProperty("rateMember").Value%>
                             </div>
                            Rating 2:
                             <div class='rating-<%# ((dynamic) Container.DataItem).getProperty("nextRating").Value %>'>
                                    <%# ((dynamic)Container.DataItem).getProperty("nextRating").Value%>
                             </div>
                       </div>
               </ItemTemplate>
              <HeaderTemplate><ul></HeaderTemplate>
             <FooterTemplate></ul></FooterTemplate>
          </asp:Repeater>

           public partial class MembersList : System.Web.UI.UserControl
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                var memberGroup = MemberGroup.GetByName("Rate Member");
              
                rp_membersList.DataSource = memberGroup.GetMembers();
                rp_membersList.DataBind();
              
            }
        }

    Built and transfer relevant files.

    Second

    Created new DataType "Umbraco Usercontrol wrapper " selecting rating dropdownlist user control.

    Created new Macro from Member listing usercontrol

    Third

    Created new Member Type  and added new rating control control times to in my case generic tab.

    Fourth

    Created new members selecting new Member type and so allowing in to set variuos rating.

    Lastly

    Created new content form with Member list macro embedded to list out members and ratings.

    Giving the following output

  • Bobby 43 posts 63 karma points
    Oct 20, 2011 @ 08:32
    Bobby
    0

    Hi Anothny,

    Thanks for your solution, I will try this out.As i am using .Net 3.5 framework and Umbraco 4.5.2

     

    Thanks

    Bobby

     

  • Anthony pj 40 posts 63 karma points
    Oct 20, 2011 @ 11:44
    Anthony pj
    0

    your welcome let me know how you get on

Please Sign in or register to post replies

Write your reply to:

Draft