Problems Adding Ratings to Custom Pages

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
6/12/2009 10:29:02 AM
Gravatar
Total Posts 131

Problems Adding Ratings to Custom Pages

I have a custom module and would like to use the mojoRating control by applying the custom content guid.  The I'm having is this:

When I add to a page, everything is ok, but I can't access the custom properties like 'ContentGuid'.  When I check the code behind desginer file, the control is added as

protected global::System.Web.UI.UserControl mpRating;

but in the basic mojo models it's added as

protected global::mojoPortal.Web.UI.mojoRating Rating;

Since the designer file is system generated, I don't want to change it.  Am I missing something in my custom project Web.config or something?  I've also noticed that the control is not included in the toolbox.  Is there a reason for that as well?  Should I just add it?

 

6/12/2009 10:51:51 AM
Gravatar
Total Posts 18444

Re: Problems Adding Ratings to Custom Pages

Hi David,

If all else fails you can cast the UserControl as mojoRating in code and set the property. UserControls are difficult to use across projects in a strongly typed manner but you can set properties declaratively. I use it in WebStore project and bind it in a repeater in the product list like this:

<portal:mojoRating runat="server" ID="Rating" ContentGuid='<%# Eval("Guid") %>' Visible='<%# (EnableRatings && Convert.ToBoolean(Eval("EnableRating"))) %>' AllowFeedback='<%# EnableRatingComments %>' ShowPrompt="true" PromptText='<%# Resources.WebStoreResources.RatingPrompt %>'  />

I'm really not very happy with the implementation of the mojoRating control, it renders too much javascript into the page, really its the AjaxToolkit rating control that does this, at some point I'm going to find a better implementation.

Adding this to the <pages><controls> section of your project's Web.config and adding a reference to mojoPortal.Web may or may not help

<add tagPrefix="portal" tagName="mojoRating" src="~/Controls/mojoRating.ascx" />

Best,

Joe

 

You must sign in to post in the forums. This thread is closed to new posts.