MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

Can't figure out Rating  (Mono Support )

Viewed 27991 time(s), 13 post(s) 12/19/2011 5:41:15 PMby grant.stone007
khorvat

khorvat

12/27/2011 10:59:01 AM
Hi,

you did everything correctly the problem still remains because this isn't the problem related to the MessageDetails. To get these two controls to co-operate try to put the following code just below the base.OnInit call as per below sample:
protected override void OnInit(EventArgs e)
{
  base.Rating += new EventHandler<RatingEventArgs>(myRating);
  base.Rated += new EventHandler<MonoSoftware.Core.EventArgs<decimal>>(myRated);
  base.OnInit(e);
  ....
  rpt.DataSource = RatingBusinessLogicLayer.GetRatingCollection(ParentEntityId, ParentEntityType, false, 15);
  rpt.DataBind();
  ....
}

Let me know if that did the trick.

Regards
Rated 5.00, 1 vote(s). 
15993 Reputation 2214 Total posts
grant-stone007

grant.stone007

12/28/2011 2:55:34 AM
I have devised a solution by taking a different approach. I customized the MessageCreate.ascx and some class overrides as opposed to the custom usercontrol I was attempting before. See my markup and code below. This works perfectly using the standard MonoXRating.ascx.

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="myMessageDetails.ascx.cs" Inherits="myMessageDetails" %>
...

<%@ Register TagPrefix="MonoX" TagName="Rating" Src="/MonoX/Controls/MonoXRating.ascx" %>
...

<
asp:Panel runat="server" ID="pnlContainer">
    <div class="input-form reply-message">
    <dl>
    <dd>
 
<MonoX:Rating ID="ctlRating" runat="server"
    ParentEntityType="Message"
    OnRating="myOnRating"
    OnRated="myOnRated"
    ShowRatingHistory="true"
/>
<br />
        <asp:Label ID="lblMessage" runat="server" AssociatedControlID="txtMessage"></asp:Label>
        <asp:TextBox ID="txtMessage" Rows="8" TextMode="MultiLine" runat="server"></asp:TextBox>
    </dd>


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;
 
using MonoSoftware.MonoX.Controls;
using MonoSoftware.MonoX.Repositories;
using MonoSoftware.MonoX.DAL.EntityClasses;
using MonoSoftware.MonoX.Utilities;
 
using MonoSoftware.MonoX;
using MonoSoftware.MonoX.API;
using System.Configuration;
using Telerik.Web.UI;
 
/// <summary>
/// Summary description for myMessageDetails
/// </summary>
public partial class myMessageDetails : MonoSoftware.MonoX.ModuleGallery.SocialNetworking.MessageDetails
{
    public myMessageDetails()
    {
        //
        // TODO: Add constructor logic here
        //
    }
 
    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);
            MonoSoftware.MonoX.Controls.MonoXRating r (MonoSoftware.MonoX.Controls.MonoXRating)this.FindControl("ctlRating");
      
r.ParentEntityId = this.MessageId;
      r.DataBind();   
    }
 
    protected void myOnRating(object sender, EventArgs e)
    {
        MonoSoftware.MonoX.Controls.MonoXRating r = (MonoSoftware.MonoX.Controls.MonoXRating)this.FindControl("ctlRating");
        r.ParentEntityId = this.MessageId;
    }
 
    protected void myOnRated(object sender, MonoSoftware.Core.EventArgs<decimal> e)
    {
        //e.Value has the rating <decimal>.
   //do something based upon the rating...
    
}
}

This content has not been rated yet. 
647 Reputation 69 Total posts
khorvat

khorvat

12/28/2011 11:32:34 AM
Hi,

It's great to hear that you have found the solution that suites you, let us know if you need anything else.

Regards
Rated 5.00, 1 vote(s). 
15993 Reputation 2214 Total posts
1 2