Click here to Skip to main content
15,884,879 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
How can I update asp.net ajax rating control value by Javascript. There are multiple rating controls in my page. So I can not have access to them by
C#
function SetParentReview(appid) {
var ratingValue = $find("rt_" + id).get_Rating();
 $find("rcGrid_" + appid).set_Rating(Number(2));
}

these both lines can not access the control. In my gridview it is as follows.
XML
<ajax:Rating  ID='rcGrid_' BehaviorID='rcGrid_<%# Eval("AppId") %>' CurrentRating='<%# Eval("avgRating") %>'  runat="server" StarCssClass="ratingEmpty" WaitingStarCssClass="ratingSaved" EmptyStarCssClass="ratingEmpty" FilledStarCssClass="ratingFilled">

also how can i update after accessing these controls in javascript.
Posted
v3
Comments
What is the problem ? Have you debugged it ?
rahul-4u 28-May-13 2:28am    
yes i have debugged it. But in javascript it can not find $find("rt_" + id).get_Rating();
it is saying Type error $find is null for this.
What is "rt_" here ?
rahul-4u 28-May-13 2:35am    
i have 2 rating controls having same values. 1 in gridview column and another one in a popup which opens after a link on gridview row. so it is

<ajax:Rating ID='rt_' BehaviorID='rt_<%# Eval("AppId") %>' CurrentRating='<%# Eval("avgRating") %>' runat="server" StarCssClass="ratingEmpty" WaitingStarCssClass="ratingSaved" EmptyStarCssClass="ratingEmpty" FilledStarCssClass="ratingFilled">
But the code you pasted before in question has "rcGrid_".

1 solution

Just adding an answer to remove this from Unanswered list.

OP has implemented it by replacing the Asp.Net rating control to his own custom javaScript rating control.

Good work @rahul-4u...

If you can post what are the steps you followed, that will be awesome.
Instead you can also add a Tip/Article on this to explain how you did it in javaScript.

I can find many articles in Google to do this in jQuery/javaScript.
Still you can post one Tip/Article about your experience, if you can.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900