locked
Rating Control + mouseover RRS feed

  • Question

  • User-1950759250 posted

    im trying to use the ajax rating control , but i want to add one small thing to it.
    i want to add a label and update that label according to the mouseover status of the rating control.

    i.e if the user mouse is over the:
    1st star , the label should be "not good".
    2st star , the label should be "good".
    3st star , the label should be "very good".
    etc...

    i tried adding mouseover event to the rating control and use javascript to update the label ,
    but the rating control only updates CurrentRating after user clicks on a star.(i keep getting the initial value "2")

    this is my code:

     

    <?xml:namespace prefix = ajaxToolkit /><ajaxToolkit:Rating class=st id=""Rating1" runat="server"
        CurrentRating="2"
        MaxRating="5"
        StarCssClass="ratingStar"
        WaitingStarCssClass="savedRatingStar"
        FilledStarCssClass="filledRatingStar"
        EmptyStarCssClass="emptyRatingStar"
        OnChanged="Rating1_Changed" onmouseover="javascript:{setLabel();}"/> 
    
     <script class=st type=" language="javascript">
    function setLabel()
    {
    var r=$get("Rating1");
    var cur = r.get_Rating();
    }
    </script>
    
     

     

     

    </ajaxToolkit:Rating>
    Wednesday, October 17, 2007 8:46 PM

Answers

  • User-315082118 posted
    The Raiting extender has a MouseOver event you can use, this event is different from the onmouseover event you are trying to use, here’s an example of how to set it up:<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>

     

    <o:p> Add this script to your page:</o:p><o:p>
    1    <script language="javascript">
    2    function onMouseOver(source, args) {    
    3        alert(args.get_Rating());
    4    }
    5    
    6    function pageLoad() {    
    7        $find("Rating1_RatingExtender").add_MouseOver(onMouseOver);
    8    }
    9   </script>
    

     Hope this helps,

    Elias.</o:p>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, October 18, 2007 8:40 AM

All replies

  • User-315082118 posted
    The Raiting extender has a MouseOver event you can use, this event is different from the onmouseover event you are trying to use, here’s an example of how to set it up:<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>

     

    <o:p> Add this script to your page:</o:p><o:p>
    1    <script language="javascript">
    2    function onMouseOver(source, args) {    
    3        alert(args.get_Rating());
    4    }
    5    
    6    function pageLoad() {    
    7        $find("Rating1_RatingExtender").add_MouseOver(onMouseOver);
    8    }
    9   </script>
    

     Hope this helps,

    Elias.</o:p>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, October 18, 2007 8:40 AM
  • User-1950759250 posted

    works great , thank you!

    This is just what i needed :)

     

    Thursday, October 18, 2007 12:44 PM