kentico_janh wrote: Hello,
You can use the same control, which is used in the
Blog Comment Viewer web part. What is need to do is to place this control into the transformation, which is selected for your
Message Board web part. So please just register this control in your transformation:
<%@ Register Src="~/CMSAdminControls/UI/UserPicture.ascx" TagName="UserPicture" TagPrefix="cms" %>
And add the following code to a place, where you want to display user's avatar:
<cms:UserPicture ID="userPict" runat="server" EnableViewState="false" Visible="true" OuterDivCSSClass="CommentUserPicture" RenderOuterDiv="true" Width="80" Height="80" UserID='<%#Eval("MessageUserID")%>' />
Best regards,
Jan Hermann
It works until a non registered user post a message...
As I understand if a non registered post a message, Kentico throw an error (probably because he cannot find an image or a userid) when trying to show the message...
The message is posted but cannot be displayed.
Is there a way to avoid that?
Because I need to show a difference between registered user and not registered ones...The error is:
<span title="Message: [CMSAbstractTransformation.DataBind]: Specified cast is not valid.
Stack Trace:
at ASP.cmstransformations_bc9177ce_509f_489f_9a6d_2d3904da2ec1_community_transformations_messageboard_ascx.__DataBindinguserPict(Object sender, EventArgs e) in http://server/CMSTransformations/bc9177ce-509f-489f-9a6d-2d3904da2ec1/community/transformations/messageboard.ascx:line 11
at System.Web.UI.Control.OnDataBinding(EventArgs e)
at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)
at System.Web.UI.Control.DataBind()
at System.Web.UI.Control.DataBindChildren()
at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)
at CMS.Controls.CMSAbstractTransformation.DataBind()
" class="TransformationError">[CMSAbstractTransformation.DataBind]: Specified cast is not valid.</span>
If I remove the code to show the picture, everything is ok...
Thanks