Rating - Rate and Leave a Comment

5 posts, 1 answers
  1. ITA
    ITA avatar
    383 posts
    Member since:
    Aug 2009

    Posted 18 May 2014 Link to this post

    Hi,

    i tried out your Rating-Example "Rating - Rate and Leave a Comment" which works great, but how do
    i get the Rating Object in the "btnPostComment_Click" Event?

    Thanks
    Best Regards
    Rene
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 18 May 2014 in reply to ITA Link to this post

    Hi,

    Please try the following C# code snippet to access the Object of RadRating in "btnPostComment_Click" event.

    C#:
    RadRating ratingControl = this.FindControl("RadRating1") as RadRating;

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. ITA
    ITA avatar
    383 posts
    Member since:
    Aug 2009

    Posted 19 May 2014 in reply to Shinu Link to this post

    Hi,

    i tried your example, but ratingControl is null!

    thanks
    Rene
  5. ITA
    ITA avatar
    383 posts
    Member since:
    Aug 2009

    Posted 19 May 2014 in reply to ITA Link to this post

    Hi,

    I think I have to explain a little more. I use MasterPpage with ContentPlaceHolder. On my Page I use a RadGrid and a coloumn with a RadRating Control. After rating I open the tooltip and after "btnPostComment_Click" I want get the actual rating to write back in my database.

    But I can't access the right Row in RadGrid.

    Thanks
    Rene
  6. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 19 May 2014 in reply to ITA Link to this post

    Hi,

    I guess your RadRating is inside the ItemTemplate of RadGrid. Please have a look into the following code snippet to access the ItemTemplate control of RadGrid and also take a look into this help documentation which discuss about Accessing Cells and Rows of RadGrid.

    C#:
    protected void btnPostComment_Click(object sender, EventArgs e)
    {
         foreach (GridDataItem item in RadGrid1.Items)
         {
             RadRating ratingControl = item.FindControl("RadRating1") as RadRating;
         }
    }

    Let me know if you have any concern.
    Thanks,
    Shinu.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017