RadRating within RadGridView

4 posts, 0 answers
  1. Al
    Al avatar
    5 posts
    Member since:
    Nov 2011

    Posted 01 Jan 2012 Link to this post

    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.
  2. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 02 Jan 2012 Link to this post

    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 >>

  3. DevCraft banner
  4. Al
    Al avatar
    5 posts
    Member since:
    Nov 2011

    Posted 05 Jan 2012 Link to this post

    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.
  5. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 06 Jan 2012 Link to this post

    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 >>

Back to Top