Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Rating > Acces to a Nested RadRating Property in JavaScript Function(Handling OnClientRated)

Answered Acces to a Nested RadRating Property in JavaScript Function(Handling OnClientRated)

Feed from this thread
  • Ahmad avatar

    Posted on Apr 18, 2011 (permalink)

    Hi,
    After writing OnClientRated Function for a RadRating (A nested one) as below:

    function OnClientRated(sender, args)
    {
        ...
    }

    How Can I Convert sender to RadRating here, My goal is to access a property of my specific RadRating Control(I'm using RadRating in a DataList Control ). I know that I can do it in ItemDataBound event of DataList, But it's not good enough considering that I have to use the value here in JavaScript Function(I'm going to use it as a QueryString Value in order to redirect to a page shown in RadWindow).
    Would you please help me out?

    Reply

  • Answer Niko Niko admin's avatar

    Posted on Apr 20, 2011 (permalink)

    Hi Ahmad,

    The sender argument is indeed the rating object. In JavaScript, being a scripting language, there is no casting. Therefore you can directly use the sender as an instance of RadRating.
    function OnClientRated(sender, args)
    {
        var value = sender.get_value();
    }
    Or even better, the way I am used to writing the event handlers on the client side:
    function OnClientRated(rating, args)
    {
        var value = rating.get_value();
    }


    Hope this helps.

    Regards,
    Niko
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

    Reply

  • Ahmad avatar

    Posted on Apr 20, 2011 (permalink)

    Hi Niko
    Thanks for your answer, I tried it and it works, the question is, I wish to access ToolTip Property of my rating, it's not working whatever I do, Would you please help me out in this matter?

    Reply

  • Answer Niko Niko admin's avatar

    Posted on Apr 20, 2011 (permalink)

    Hello Ahmad,

    On the client-side the ToolTip attribute is rendered as a title attribute. Therefore you need to look for the title instead. Here is a sample code to accomplish this:
    function showToolTip(rating, args)
    {
        alert($get(rating.get_id()).getAttribute("title"));
    }

    Please, let me know if you will need anything else.

    Best wishes,
    Niko
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

    Reply

  • Ahmad avatar

    Posted on Apr 20, 2011 (permalink)

    Thank you so much!

    Reply

  • Ahmad avatar

    Posted on Apr 27, 2011 (permalink)

    Hello again,

    In the same scenario I need to fire both Rated and OnClientRated events, but it seems that when I use OnClientRated, the Rated event is not even fired, would you please help me out in this matter? Is there any way to have both events working, or an alternative event?

    Thanks

    Reply

  • Niko Niko admin's avatar

    Posted on Apr 27, 2011 (permalink)

    Hi Ahmad,

    The problem may be caused by a browser dialog, i.e. alert, confirm, prompt. etc. Please, make sure that you are not raising any of these, as this will prevent the postback to the server. Also make sure that there are no JavaScript errors in the handler function. Otherwise, I will need to check the code of the event handler for anything that may be causing the incorrect behavior.

    Best wishes,
    Niko
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Rating > Acces to a Nested RadRating Property in JavaScript Function(Handling OnClientRated)
Related resources for "Acces to a Nested RadRating Property in JavaScript Function(Handling OnClientRated)"

ASP.NET Rating Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  |  Step-by-step Tutorial  ]