+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Cannot edit comments in modules after upgrade to 3.7

Cannot edit comments in modules after upgrade to 3.7

15 posts, 0 answered
  1. Tim
    Tim avatar
    9 posts
    Registered:
    06 Sep 2010
    09 Sep 2010
    Link to this post
    Hi,

    Please excuse the fact I have limited information on this issue, I have only been at this site for a week.

    Recently there has been an upgrade to 3.7. Now in all modules clicking on Edit in the Comments listing throws an error:

    A required control was not found in the template for "". The control must be assignable form type "Telerik.Web.UI.RadEditor" and must have ID "commentTxt".

    This is what CommentsEdit.ascx looks like.

    <%@ Register Assembly="Telerik.Cms.Web.UI" Namespace="Telerik.Cms.Web.UI" TagPrefix="sfWeb" %>
     
    <sfWeb:MessageControl runat="server" ID="messageCtrl">
        <ItemTemplate>
            <asp:Label ID="messageText" runat="server"></asp:Label>
        </ItemTemplate>
    </sfWeb:MessageControl>
    <div class="ToolsAll">
        <div class="backWrapp">
            <asp:LinkButton runat="Server" ID="backButton" Text="<%$Resources:BackToAllComments %>" CssClass="actions back"></asp:LinkButton>
        </div>
    </div>
    <div class="workArea">
        <div class="mainForm comm">
        <p class="mand">* <asp:Literal runat="server" Text="<%$Resources:MandatoryFields %>"></asp:Literal></p>
        <h3 class="commHead"><asp:Literal runat="server" Text="<%$Resources:ACommentOn %>"></asp:Literal> <asp:LinkButton runat="Server" ID="parentLink"></asp:LinkButton></h3>
        <fieldset class="set">
            <ol class="setIn">
                <li>
                    <asp:Label AssociatedControlID="commentTxt" runat="server" ID="commentLabel" Text="<%$Resources:Comment %>"></asp:Label>
                    <asp:TextBox runat="Server" ID="commentTxt" TextMode="MultiLine" ValidationGroup="commentsInfo"></asp:TextBox>
                    <asp:RequiredFieldValidator runat="server" ID="contentVal" ControlToValidate="commentTxt" ErrorMessage="*" Display="dynamic" ValidationGroup="commentsInfo"></asp:RequiredFieldValidator>
                </li>
                <li>
                    <asp:Label AssociatedControlID="authorTxt" runat="server" ID="authorLabel" Text="<%$Resources:Author %>"></asp:Label>
                    <asp:TextBox runat="server" ID="authorTxt" ValidationGroup="commentsInfo" MaxLength="50"></asp:TextBox>
                    <asp:RequiredFieldValidator runat="server" ID="authorVal" ControlToValidate="authorTxt" ErrorMessage="*" Display="dynamic" ValidationGroup="commentsInfo"></asp:RequiredFieldValidator>
                </li>
                <li style="display: none">
                    <asp:Label AssociatedControlID="emailTxt" runat="server" ID="emailLabel" Text="<%$Resources:Email %>"></asp:Label>
                    <asp:TextBox runat="server" ID="emailTxt" ValidationGroup="commentsInfo"></asp:TextBox>
                    <asp:RegularExpressionValidator runat="server" ID="emailVal" ControlToValidate="emailTxt" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" ErrorMessage="*" Display="dynamic" ValidationGroup="commentsInfo"></asp:RegularExpressionValidator>
                </li>
                <li style="display: none">
                    <asp:Label AssociatedControlID="webSiteTxt" runat="server" ID="webSiteLabel" Text="<%$Resources:WebSite %>"></asp:Label>
                    <asp:TextBox runat="server" ID="webSiteTxt"></asp:TextBox>
                </li>
            </ol>
        </fieldset>
        <div class="bottom"><div><!-- --></div></div>
        <h3><asp:Literal runat="server" Text="<%$Resources:Status %>"></asp:Literal></h3>
        <fieldset class="set">
            <div class="setIn">
            <h5><asp:Literal runat="server" Text="<%$Resources:ThisCommentIs %>"></asp:Literal>:</h5>
            <asp:RadioButtonList runat="Server" ID="visibleComment" RepeatDirection="Horizontal" RepeatLayout="Flow" CssClass="radio">
                <asp:ListItem Text="<%$Resources:Visible %>" Value="Visible"></asp:ListItem>
                <asp:ListItem Text="<%$Resources:Hidden %>" Value="Hidden"></asp:ListItem>
            </asp:RadioButtonList>
            </div>
        </fieldset>
        <div class="bottom"><div><!-- --></div></div>
        <p class="button_area">
        <asp:LinkButton ID="saveBtn" runat="server" ValidationGroup="commentsInfo" CssClass="CmsButLeft okdark"><strong class="CmsButRight dark"><asp:Literal runat="server" Text="<%$Resources:SaveChanges %>"></asp:Literal></strong></asp:LinkButton>
        <span> <asp:Literal runat="server" Text="<%$Resources:Or %>"></asp:Literal> </span>
        <asp:LinkButton CssClass="cmscclcmd" runat="Server" ID="cancelBtn" Text="<%$Resources:Cancel %>"></asp:LinkButton>
        </p>
        </div>
    </div>

    If I amend CommentsEdit.ascx and change the Textbox to the default RadEditor as per Generic_Content, I then get this error:

    Please, use the Content property of RadEditor to set its content.
    The value of the Text property is generated using the value of the Content property.

    This was all working fine before the upgrade, with CommentsEdit.ascx using a Textbox instead of the RadEditor.

    The error occurs in CreateChildContols of ControlPanel, which I cannot see as it's compiled.

    Has anyone else experienced something like this? Or have any idea what might have changed in the upgrade?

    I'll try to provide more information if anyone has any ideas.

    Thanks,
    Tim

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    09 Sep 2010
    Link to this post
    Hello Tim,

    You use TextBox, but the expected control is RadEditor. You have to use RadEditor instead of TextBox, otherwise you need to override CommentsList control  behavior and replace the default one. RadEditor is set as a required control.

    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Tim
    Tim avatar
    9 posts
    Registered:
    06 Sep 2010
    09 Sep 2010
    Link to this post
    Thanks Ivan. I have tried replacing the Textbox with a RadEditor, which is when the I get the following error:

    "Please, use the Content property of RadEditor to set its content.
    The value of the Text property is generated using the value of the Content property."

    If I look at the version running before the upgrade I am able to edit comments no worries, and it's using a Textbox not a RadEditor. Which leads me to believe that perhaps some custom code was written to facilitate this, and the upgrade has overwritten that. Would this be possible?

    Is there anywhere I can look for evidence of this, or is it all compiled in the dll?

    Any ideas why it doesn't work even with a RadEditor instead of Textbox?
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    09 Sep 2010
    Link to this post
    Hi Tim,

    Since 3.6 we use embedded templates. You could use the built-in one which will be loaded from the Telerik.Cms.Engine assembly. It looks like you have mapped the template for comments and there are some issues with the HTML code inside it or you are using a custom view.

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Tim
    Tim avatar
    9 posts
    Registered:
    06 Sep 2010
    10 Sep 2010
    Link to this post
    Thanks Ivan.

    The version previous to the upgrade was 3.5 and the view being used then is the one that I posted in my initial query. It uses a Textbox instead of a RadEditor. Obviously with the changes since 3.6 this no longer works.

    Is there a way to continue using a Textbox instead of a RadEditor in CommentsEdit.ascx for editing comments in modules? If you could point my in the right direction here that would be fantastic. I have seen a couple threads explaining how this can be done in 3.6 for Blogs. Can that be applied to Modules also?

    Regards,
    Tim


  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    10 Sep 2010
    Link to this post
    Hi Tim,

    To use TextBox - you have to

    1. Replace the default view Telerik.Cms.Engine.WebControls.Admin.CommentsEdit -replacing child view with another one

    2. Set RadEditor control as not required control and declare a textbox in your template

    /// <summary>
    /// control reference to the RadEditor contoro - make it not required and remove it from the template
    /// </summary>
    protected override RadEditor CommentText
    {
        get { return base.Container.GetControl<RadEditor>("commentTxt", false); }
    }
     
    /// <summary>
    /// add control reference to TextBox control that is declared into template
    /// </summary>
    protected virtual IEditableTextControl TextBoxCommentText
    {
        get { return base.Container.GetControl<IEditableTextControl>("textboxContentTxt", true); }
    }

    3. Override InitializeControls and set the IComment text to the TextBoxCommentText.Text

    TextBoxCommentText.Text = comment.Text;


    Sincerely yours,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. Tim
    Tim avatar
    9 posts
    Registered:
    06 Sep 2010
    15 Sep 2010
    Link to this post
    Thanks Ivan. I have tried to implement your solution without any luck. I created a custom CommentsEdit view:

    using System;
    using System.Web;
    using System.Web.UI;
    using Telerik.Cms.Engine.WebControls.Admin;
    using Telerik.Web.UI;
     
    namespace Namespace.Sitefinity.Modules.Common
    {
     
        public class CustomCommentsEdit : CommentsEdit<GenericControlPanel>
        {
     
            public override System.Type LocalizationAssemblyInfo
            {
                get
                {
                    return typeof(GenericControlPanel);
                }
                set
                {
                    base.LocalizationAssemblyInfo = value;
                }
            }
     
            public override System.Type AssemblyInfo
            {
                get
                {
                    return typeof(GenericControlPanel);
                }
                set
                {
                    base.AssemblyInfo = value;
                }
            }
     
            /// <summary>
            /// control reference to the RadEditor control - make it not required and remove it from the template
            /// </summary>
            protected override RadEditor CommentText
            {
                get { return base.Container.GetControl<RadEditor>("commentTxt", false); }
            }
     
            /// <summary>
            /// add control reference to TextBox control that is declared in template
            /// </summary>
            protected virtual IEditableTextControl TextBoxCommentText
            {
                get { return base.Container.GetControl<IEditableTextControl> "textboxCommentTxt", true); }
            }
     
        }
     
    }


    and added the following to the Controls Config file.

    <viewSettings hostType="Telerik.Cms.Engine.WebControls.Admin.GenericControlPanel, Telerik.Cms.Engine">
      <views>
        <remove name="CommentsEdit"></remove>
        <add name="CommentsEdit" viewType="Namespace.Sitefinity.Modules.Common.CustomCommentsEdit, Namespace.Sitefinity.Modules"></add>
      </views>
    </viewSettings>


    But unfortunately it made no difference. My new view CustomCommentsEdit is not being used, it's still using the default view.

    Does the above look correct?

    Regards,
    Tim



  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    15 Sep 2010
    Link to this post
    Hello Tim,

    The mapping is not correct. It should be

    <viewSettings hostType="Telerik.Cms.Engine.WebControls.Admin.CommentsView`1[[Telerik.Cms.Engine.WebControls.Admin.GenericControlPanel, Telerik.Cms.Engine]]">
         <views>
           <remove name="CommentsEdit`1" />
           <add name="CommentsEdit`1" viewType="CommentsEditCustom, App_Code" title="CommentsEditCustom" ></add>
         </views>
       </viewSettings>

    where the overridden view is as shown below

    public class CommentsEditCustom : CommentsEdit<CommentsView<GenericControlPanel>>
    {
        public CommentsEditCustom()
        {
            
        }
    }


    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  9. Tim
    Tim avatar
    9 posts
    Registered:
    06 Sep 2010
    15 Sep 2010
    Link to this post
    Thanks for your help and patience Ivan. I had tried it like that but to no avail. I don't have an App_Code folder as this is a web app, which is why I had placed the custom class in a different namespace. That shouldn't make a difference should it?

    The error I receive is in Telerik.Cms.Engine.WebControls.Admin.ControlPanel.CreateCommentsEdit():

    "Please, use the Content property of RadEditor to set its content.
    The value of the Text property is generated using the value of the Content property."

    Do you have any idea why I would be getting this error?

    I can't seem to get your solution to work using a TextBox, and I can't leave it as the default and use a RadEditor either. My preference is to get it working using a TextBox, but I at least need to get it working using a RadEditor. Why would it be trying to set the Text property in Telerik.Cms.Engine.WebControls.Admin.ControlPanel.CreateCommentsEdit?

    Regards,
    Tim
  10. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    15 Sep 2010
    Link to this post
    Hi Tim,

    It looks like the project has not been upgraded, because
    Telerik.Cms.Engine.WebControls.Admin.ControlPanel.CreateCommentsEdit(): should not be used. The base control panel is Telerik.Cms.Engine.WebControls.Admin.GenericControlPanel which is used in the mapping. I verified the mapping and custom class and it works fine.

    Regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  11. Tim
    Tim avatar
    9 posts
    Registered:
    06 Sep 2010
    16 Sep 2010
    Link to this post
    Ok now it's all starting to make sense!

    Yes this is happening in 2 custom modules which were developed before 3.6, but isn't 3.6 supposed to be backwards compatible? I don't think it's an option to completely rewrite these 2 modules using the new architecture.

    Is there any way to get these pre 3.6 modules working with version 3.7? I'm pretty sure editing comments is the only thing broken by the upgrade.

    Otherwise, would it be possible to create a new view just for editing comments, and leave the rest as is?

    Thanks again Ivan.


  12. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    16 Sep 2010
    Link to this post
    Hello Tim,

    There are changes in the architecture new backend architecture and upgrade is supposed to completely cover all built-in functionality during upgrade which I believe is done.

    Anyway, I made some changes to the ControlPanel class which will be available in the forthcoming SP ( we will release it in a week I hope so). You have to upgrade a test project and see whether the issue is fixed then. I am not able to provide you with workaround for this case.

    All the best,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  13. Tim
    Tim avatar
    9 posts
    Registered:
    06 Sep 2010
    17 Sep 2010
    Link to this post
    Ok great. I'll keep my eye out for the next SP release and hopefully that will fix it!

    Thank you very much for your time Ivan, much appreciated.

    Regards,
    Tim
  14. Tim
    Tim avatar
    9 posts
    Registered:
    06 Sep 2010
    22 Sep 2010
    Link to this post
    Ivan is the fix for this in SP4 which has just been made available?
  15. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    22 Sep 2010
    Link to this post
    Hi Tim,

    I made some changes to CommentsList class that should fix "Please, use the Content property of RadEditor to set its content. The value of the Text property is generated using the value of the Content property." which are available in Sitefinity 3.7 SP4.

    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Register for webinar
15 posts, 0 answered