This is a migrated thread and some comments may be shown as answers.

RadRating within RadGridView

3 Answers 111 Views
Rating
This is a migrated thread and some comments may be shown as answers.
Al
Top achievements
Rank 2
Al asked on 01 Jan 2012, 08:50 AM
I have a RadGridView with a column containing a RadRating control. The control initializes fine and displays the number of items. My problem is that the Value field is set to bind and the stars do not fill. I read something about the control using the number of items but that made no sense to me. I simply have a rating value of say 3 and want the thing to display 3 stars filled of the 5 stars displayed. Note that I am able to create a similar effect in asp.net.

Look at online demo for GridView control and instead of the TextBlock control I am using the RadRating control...

<telerik:RadRating Value="{Binding Rating}" />

Thanks for any help you can provide.

3 Answers, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 02 Jan 2012, 07:26 PM
Hi Albert,

I prepared a sample project demonstrating a possible approach towards your scenario. It works as expected on our side. Can you please have a look at it and let me know if it works for you or if I'm missing something? Thank you in advance.

Regards,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Al
Top achievements
Rank 2
answered on 05 Jan 2012, 07:51 PM
Tina
Your sample works well. Now I need to know if there is an issue with something more specific. I am using a WCF to grab data. The data returned has everything I need, including a rating (System.Decimal). I bind this data to a GridView. The grid fills fine; there are strings, dates and of course the rating. Here is the column that will not display properly:

                <telerik:GridViewDataColumn Header="Scorecard" IsFilterable="True" IsGroupable="False" IsReadOnly="True" Width="120">
                    <telerik:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <telerik:RadRating IsEnabled="False" NumberOfItemsToGenerate="5" Value="{Binding Raiting, Mode=TwoWay}" />
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellTemplate>
                </telerik:GridViewDataColumn>

This is really strange. The results in the callback have values. The grid in question is refreshed with data when an item is selected in a grid above it (it runs a search process based on the selection in the grid plus some settings). I do see the rating displayed, but the stars will not fill to say 3 or 4 - the actual rating for that row of data.

Thanks.
0
Tina Stancheva
Telerik team
answered on 06 Jan 2012, 10:10 AM
Hi Albert,

That is really strange as we aren't aware of any issues with the RadRating control in scenarios like yours. The only issue with the RadRating value we have encountered is in a scenario where the control's Visibility property is changed. You can have a look at the issue describtion in our PITS. But I don't see a relation between your case and that issue. And this is why I am not sure how to reproduce it. I tried changing the type of the Rating business property to Decimal to see if this may be causing issues but it works as expected.

However, since I am not sure how you get the data through WCF and how you pass it to the GridView controls, it would help us if you try to reproduce the issue in a small sample - you can use my solution as a starting point.

Most often than not, the problem is not database–related. It would be great to send us your database but if for some reason this is not possible, you can use a dummy DB that would allow the RadGridView control to appear on the page or the Microsoft’s common databases – Northwind, AdventureWorks and etc. that can be easily found and downloaded.

Also please try to determine which are the controls from your solution that are not related to this issue. I'd suggest you to use the ‘remove and try’ approach when it is hard for you to determine what is causing the problem. This means that you should remove parts of the code and check if the issue reproduces without it. Keep doing this till you find the cause for the problem.

Thank you in advance for all your cooperation on the matter.

Kind regards,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
Rating
Asked by
Al
Top achievements
Rank 2
Answers by
Tina Stancheva
Telerik team
Al
Top achievements
Rank 2
Share this question
or