Hey!
I am using RadRating inside listView here is the code:
<asp:ScriptManager ID="ScriptManager" runat="server"></asp:ScriptManager>
<asp:ListView ID="lstTweets" runat="server" ItemPlaceholderID="ListViewContainer"
</asp:ListView>
When I click the event fires and everything, but sender of event has value and other attributes set to default value (0), no mather what I click. And when the event finishes, the value of RadRating isn't where I clicked.
Sincerely, Jure
I am using RadRating inside listView here is the code:
<asp:ScriptManager ID="ScriptManager" runat="server"></asp:ScriptManager>
<asp:ListView ID="lstTweets" runat="server" ItemPlaceholderID="ListViewContainer"
OnItemDataBound="LstTweets_ItemDataBound"
onpagepropertieschanged="LstTweets_PagePropertiesChanged">
<ItemTemplate>
<fieldset>
<telerik:RadRating ID="rtgRank" runat="server" AutoPostBack="true" OnRate="rtgRank_Rate" />
</fieldset>
<telerik:RadRating ID="rtgRank" runat="server" AutoPostBack="true" OnRate="rtgRank_Rate" />
</fieldset>
</ItemTemplate>
</asp:ListView>
When I click the event fires and everything, but sender of event has value and other attributes set to default value (0), no mather what I click. And when the event finishes, the value of RadRating isn't where I clicked.
Sincerely, Jure
14 Answers, 1 is accepted
0
Accepted
Hi Jure,
I created a simple test page in order to try to reproduce the problem you have - please find it attached. The attached page works as expected, however, in case I remove the following condition, I am able to reproduce the problem you have:
This, however, is expected - you will reproduce the same result with a standard ASP DropDownList control:
Basically, the problem comes from the fact that you recreate the child controls of the ListView control (by calling the DataBind method) after the LoadViewState stage. You can read more about the page lifecycle in MSDN. In case you want the controls in the ListView to load their ViewState correctly in this case, you can move the call to the DataBind method to the init stage:
You can refer to the following articles for additional information:
http://msdn.microsoft.com/en-us/library/hbdfdyh7.aspx
http://www.4guysfromrolla.com/articles/092904-1.aspx
Regards,
Tsvetie
the Telerik team
I created a simple test page in order to try to reproduce the problem you have - please find it attached. The attached page works as expected, however, in case I remove the following condition, I am able to reproduce the problem you have:
private
void
Page_Load(
object
sender, EventArgs e)
{
if
(!Page.IsPostBack)
{
lstTweets.DataSource =
new
int
[] { 1, 2, 3 };
lstTweets.DataBind();
}
}
This, however, is expected - you will reproduce the same result with a standard ASP DropDownList control:
<
asp:ListView
ID
=
"lstTweets"
runat
=
"server"
ItemPlaceholderID
=
"ListViewContainer"
OnItemDataBound
=
"LstTweets_ItemDataBound"
OnPagePropertiesChanged
=
"LstTweets_PagePropertiesChanged"
>
<
ItemTemplate
>
<
fieldset
>
<
telerik:RadRating
ID
=
"rtgRank"
runat
=
"server"
AutoPostBack
=
"true"
OnRate
=
"rtgRank_Rate"
/>
<
asp:DropDownList
ID
=
"DropDownList1"
runat
=
"server"
AutoPostBack
=
"true"
>
<
asp:ListItem
Text
=
"1"
></
asp:ListItem
>
<
asp:ListItem
Text
=
"2"
></
asp:ListItem
>
<
asp:ListItem
Text
=
"3"
></
asp:ListItem
>
</
asp:DropDownList
>
</
fieldset
>
</
ItemTemplate
>
</
asp:ListView
>
Basically, the problem comes from the fact that you recreate the child controls of the ListView control (by calling the DataBind method) after the LoadViewState stage. You can read more about the page lifecycle in MSDN. In case you want the controls in the ListView to load their ViewState correctly in this case, you can move the call to the DataBind method to the init stage:
protected
override
void
OnInit(EventArgs e)
{
base
.OnInit(e);
lstTweets.DataSource =
new
int
[] { 1, 2, 3 };
lstTweets.DataBind();
}
You can refer to the following articles for additional information:
http://msdn.microsoft.com/en-us/library/hbdfdyh7.aspx
http://www.4guysfromrolla.com/articles/092904-1.aspx
Regards,
Tsvetie
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0

Jure
Top achievements
Rank 1
answered on 03 Aug 2010, 08:48 AM
Thanks for your help!
This works fine now.
But I have another problem. I would like to write an ID read from database to the RadRating control.
I know how to do this with a button:
This works fine now.
But I have another problem. I would like to write an ID read from database to the RadRating control.
I know how to do this with a button:
<asp:Button ID="button1" runat="server" CommandArgument="Arg1" OnClick="Test" CommandName='<%#Eval("Tweet_ID")%>' />
But RadRating doesn't have CommandArgument and CommandName.
Sincerely, Jure
But RadRating doesn't have CommandArgument and CommandName.
Sincerely, Jure
0

Jure
Top achievements
Rank 1
answered on 03 Aug 2010, 09:04 AM
Ah I found the solution
I did this:
I did this:
<telerik:RadRating ID="rtgRank" runat="server" AutoPostBack="true" OnRate="RtgRank_Rate" TweetID='<%#Eval("Tweet_ID")%>'>
</telerik:RadRating>
And in codebehind:
string id = r.Attributes["TweetID"];
And in codebehind:
string id = r.Attributes["TweetID"];
0

Jure
Top achievements
Rank 1
answered on 03 Aug 2010, 01:33 PM
Hey!
It's me again :( I have another problem with RadRating.
I have a listview with multiple items, each item has a literal and a RadRanking control. In literal the average ranking is written.
The problem is that when I change the rank of an item I have to change it also in listViews datasource then I have to call lstTweets.DataBind() to see the changes on screen. But if I call the DataBind inside the Rate procedure the procedure will fire again. Why is that? I don't want it to start twice since it messes my averages. I tried using the OnClientRated method, but RadRating completely stops working if I put it in.
I posted some code below.
Thanks for your asistance.
Sincerely, Jure
It's me again :( I have another problem with RadRating.
I have a listview with multiple items, each item has a literal and a RadRanking control. In literal the average ranking is written.
The problem is that when I change the rank of an item I have to change it also in listViews datasource then I have to call lstTweets.DataBind() to see the changes on screen. But if I call the DataBind inside the Rate procedure the procedure will fire again. Why is that? I don't want it to start twice since it messes my averages. I tried using the OnClientRated method, but RadRating completely stops working if I put it in.
I posted some code below.
Thanks for your asistance.
Sincerely, Jure
<
telerik:RadRating
ID
=
"rtgRank"
runat
=
"server"
AutoPostBack
=
"true"
OnRate
=
"RtgRank_Rate"
TweetID='<%#Eval("Tweet_ID")%>' Value='<%#Eval("Rank")%>'>
protected void RtgRank_Rate(object sender, EventArgs e)
{
RadRating r = (sender as RadRating);
string id = r.Attributes["TweetID"];
List<
Tweet
> tweetList = (List<
Tweet
>)lstTweets.DataSource;
Tweet t = tweetList.Find(a => a.Tweet_ID == id);
// calculate average
decimal rank = (t.Rank * t.VoteCount) + r.Value;
t.VoteCount++;
rank = rank / t.VoteCount;
t.Rank = rank;
lstTweets.DataBind();
}
0
Hello Jure,
We were able to reproduce the problem and we recognize it as an issue in the RadRating control. We have logged it in our PITS system and we will do our best to six it as soon as possible.
Thank you for your feedback. Your Telerik points were updated.
All the best,
Fiko
the Telerik team
We were able to reproduce the problem and we recognize it as an issue in the RadRating control. We have logged it in our PITS system and we will do our best to six it as soon as possible.
Thank you for your feedback. Your Telerik points were updated.
All the best,
Fiko
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0

Ian
Top achievements
Rank 1
answered on 01 Mar 2011, 02:06 PM
Hi. I've got a similar problem with a RadRating control included in a RadGrid. When a user changes the value of the rating control, other columns in the grid need to be updated and so I'm calling the RadGrid_Rebind method at the end of the RadRating_Rate method. Unfortunately, this appears to be causing the RadRating_Rate method to be fired a second time which I don't really want.
You mentioned in your post dated Aug 2010 that you were looking to fix this issue. Has it been resolved yet? (I'm using release 2010.3.1109.40).
Best regards, Ian
You mentioned in your post dated Aug 2010 that you were looking to fix this issue. Has it been resolved yet? (I'm using release 2010.3.1109.40).
Best regards, Ian
0
Hi Ian,
The latest Beta version of the ASP.NET AJAX Controls incorporates the fix to this issue. You can download it from your download page. Here is the URL for your convenience - http://www.telerik.com/account/your-products/product-versions/single-download.aspx?pid=561.
Best wishes,
Nikodim
the Telerik team
The latest Beta version of the ASP.NET AJAX Controls incorporates the fix to this issue. You can download it from your download page. Here is the URL for your convenience - http://www.telerik.com/account/your-products/product-versions/single-download.aspx?pid=561.
Best wishes,
Nikodim
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0

Ian
Top achievements
Rank 1
answered on 01 Mar 2011, 04:53 PM
Hi Nikodi,
Thanks for the prompt reply. Do you expect to include this fix in the official Q1/2011 release? If so, I'll probably wait for that version rather than use the Beta.
Best regards, Ian
Thanks for the prompt reply. Do you expect to include this fix in the official Q1/2011 release? If so, I'll probably wait for that version rather than use the Beta.
Best regards, Ian
0
Hi Ian,
Certainly this fix will be part of the Q1/2011 release.
Greetings,
Nikodim
the Telerik team
Certainly this fix will be part of the Q1/2011 release.
Greetings,
Nikodim
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0

Parimala
Top achievements
Rank 1
answered on 22 Mar 2011, 05:22 AM
Hi,
I also have the same issue like RadRating_Rate event is fired twice and the value of the ID is also not obtained like Jure has mentioned in the mail "string id = r.Attributes["TweetID"];" If I do a databind then the ID is coming but the rating value goes off to 0. Is there any solution before the beta version release.
Thanks in advance
Parimala
I also have the same issue like RadRating_Rate event is fired twice and the value of the ID is also not obtained like Jure has mentioned in the mail "string id = r.Attributes["TweetID"];" If I do a databind then the ID is coming but the rating value goes off to 0. Is there any solution before the beta version release.
Thanks in advance
Parimala
0
Hi Parimala,
The issue mentioned in this thread is fixed in the current release(Q1.2011) of RadControls for ASP.NET AJAX. Please, try running your project using this version of the controls and let me know if you still run into troubles.
Greetings,
Niko
the Telerik team
The issue mentioned in this thread is fixed in the current release(Q1.2011) of RadControls for ASP.NET AJAX. Please, try running your project using this version of the controls and let me know if you still run into troubles.
Greetings,
Niko
the Telerik team
0

Suresh
Top achievements
Rank 1
answered on 27 Jul 2011, 05:26 PM
Hi,
I am trying to use Radrating control in Radlistview.
Once a item is rated I need to save data related to the item, through pagemethods using OnClientRated event.
function saverating(sender, args) {
var personId = document.getElementById("<%= hdnPersonId.ClientID %>");
var rating = sender.get_value();
function ratingsuccess(response) {
SucessMessage("Item rated successfully");
}
function ratingfail(response) {
failMessage('Operation Failed);
}
CallPageMethod('SaveRating', ratingsuccess, ratingfail, 'itemId',XXXX , 'rating',rating, 'personId', personId.value);
//I need to get the ItemId from the listview item which is unique for each row
}
</
script
>
<
telerik:RadListView
ID
=
"rdItemListView"
runat
=
"server"
PageSize
=
"5"
AllowPaging
=
"True"
ItemPlaceholderID
=
"itemPlaceholder"
DataKeyNames
=
"ItemId"
AllowCustomPaging
=
"true"
OnPageIndexChanged
=
"rdItemListView_PageIndexChanged"
>
<
LayoutTemplate
>
<
div
class="RadListView RadListView_<%#Container.Skin %>">
<
table
cellspacing
=
"0"
style
=
"width: 100%;"
>
<
thead
>
<
tr
class
=
"rlvHeader"
>
</
tr
>
</
thead
>
<
tbody
>
<
tr
id
=
"itemPlaceholder"
runat
=
"server"
>
</
tr
>
<
tr
><
td
>
</
td
>
<
td
colspan
=
"2"
>
<
telerik:RadDataPager
ID
=
"rdPager"
PageSize
=
"5"
PagedControlID
=
"rdItemListView"
runat
=
"server"
Style
=
"padding: 0 50px 0 20px"
>
<
Fields
>
<
telerik:RadDataPagerButtonField
FieldType
=
"FirstPrev"
/>
<
telerik:RadDataPagerButtonField
FieldType
=
"Numeric"
/>
<
telerik:RadDataPagerButtonField
FieldType
=
"NextLast"
/>
<
telerik:RadDataPagerPageSizeField
PageSizeText
=
"Page size: "
/>
<
telerik:RadDataPagerGoToPageField
CurrentPageText
=
"Page: "
TotalPageText
=
"of"
SubmitButtonText
=
"Go"
TextBoxWidth
=
"15"
/>
<
telerik:RadDataPagerTemplatePageField
>
<
PagerTemplate
>
<
div
style
=
"float: right"
>
<
b
>Items
<
asp:Label
runat
=
"server"
ID
=
"CurrentPageLabel"
Text="<%# Container.Owner.StartRowIndex+1%>" />
to
<
asp:Label
runat
=
"server"
ID
=
"TotalPagesLabel"
Text="<%# Container.Owner.TotalRowCount > (Container.Owner.StartRowIndex+Container.Owner.PageSize) ? Container.Owner.StartRowIndex+Container.Owner.PageSize : Container.Owner.TotalRowCount %>" />
of
<
asp:Label
runat
=
"server"
ID
=
"TotalItemsLabel"
Text="<%# Container.Owner.TotalRowCount%>" />
<
br
/>
</
b
>
</
div
>
</
PagerTemplate
>
</
telerik:RadDataPagerTemplatePageField
>
</
Fields
>
</
telerik:RadDataPager
>
</
td
>
<
td
colspan
=
"3"
>
</
td
>
</
tr
>
</
tbody
>
</
table
>
</
div
>
</
LayoutTemplate
>
<
ItemTemplate
>
<
tr
class
=
"rlvI"
>
<
td
>
<
telerik:RadRating
ID
=
"rdItemRating"
CutsomAttribute='<%#Eval("ItemId")%>' OnClientRated="saverating" runat="server">
</
telerik:RadRating
>
</
td
>
</
tr
>
</
ItemTemplate
>
<
EmptyDataTemplate
>
<
div
class
=
"RadListView RadListView_Sunset"
>
<
div
class
=
"rlvEmpty"
>
There are no items to be displayed.</
div
>
</
div
>
</
EmptyDataTemplate
>
<
SelectedItemTemplate
>
<
tr
class
=
"rlvISel"
>
</
tr
>
</
SelectedItemTemplate
>
</
telerik:RadListView
>
Problem :
How do I access the customAttribute property in the javascript, or is there way to identify the unique itemID on the client.
Any help on this is highly appreciated.
Thank You
Suresh
0

Suresh
Top achievements
Rank 1
answered on 28 Jul 2011, 09:32 PM
Hi,
Can someone answer please?
Thanks
Suresh
Can someone answer please?
Thanks
Suresh
0
Hi Suresh,
You can access the custom attribute by accessing first the rating element and then get the attribute value through the standard getAttribute method. Here is an example that you can integrate in your handler function:
Hope this helps.
Greetings,
Niko
the Telerik team
You can access the custom attribute by accessing first the rating element and then get the attribute value through the standard getAttribute method. Here is an example that you can integrate in your handler function:
var
customAttribute = sender.get_element().getAttribute(
"cutsomattribute"
);
Hope this helps.
Greetings,
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.