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

Forums / Developing with Sitefinity / Can I edit the forum templates and insert my code?

Can I edit the forum templates and insert my code?

9 posts, 0 answered
  1. xax_007
    xax_007 avatar
    55 posts
    Registered:
    24 Jul 2009
    27 Nov 2009
    Link to this post
    I would like edit ControlPanelNewForumTemplate.ascx, and averride "SaveContent()" for save the new forum, but I can´t, Can you help me?

    And add One TextBox to template...

    Salu2,
    Pablo
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    27 Nov 2009
    Link to this post
    Hi Pablo Pérez Sánchez,

    You need to create a custom class that inherits from Forum's ControlPanel. Then override CreateChildControls method and create a new instance of ForumEditor. then subscribe for ForumEditor's object Saved event and add your logic there. Note that you have to create a new database table of new datalayer to persists the value from your TextBox.

    sample:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using Telerik.Forums.WebControls;
     
    /// <summary>
    /// Summary description for ForumConrolPabelCustom
    /// </summary>
    public class ForumConrolPabelCustom : Telerik.Forums.WebControls.Admin.ControlPanel
    {
        public ForumConrolPabelCustom()
        {
            //
            // TODO: Add constructor logic here
            //
        }
     
        protected override void CreateChildControls()
        {
            ForumEditor editor = new ForumEditor();
            editor.Saved += new EventHandler<ForumEditorEventArgs>(editor_Saved);
        }
     
        void editor_Saved(object sender, ForumEditorEventArgs e)
        {
             
        }
    }

    As you can see we are not calling the base, so you need to override most of the methods and methods. Unfortunately there is no easiest way due to privacy of some of the methods.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. xax_007
    xax_007 avatar
    55 posts
    Registered:
    24 Jul 2009
    27 Nov 2009
    Link to this post
    The problem is that i can´t do

    protected virtual TextBox txtLink
            {
                get
                {
                    return base.Container.GetControl<TextBox>("Link", true, Telerik.Framework.Web.TraverseMethod.BreadthFirst);
                }

            }


    for reference the texbox in my code...

    and after i can´t do in Telerik.Sitefinity.Configuration.ControlsConfig.xml, the viewsetting...

    Thanks for reply.

    Salu2,
    Pablo
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    27 Nov 2009
    Link to this post
    Hi Pablo Pérez Sánchez,

    You are calling not existing container "base.Container", you have to see this through intellisense. You need to create a custom container or search for the control recursively.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. xax_007
    xax_007 avatar
    55 posts
    Registered:
    24 Jul 2009
    27 Nov 2009
    Link to this post
    Ok,

    And  after i can´t do in Telerik.Sitefinity.Configuration.ControlsConfig.xml, the viewsetting... for Forum,  have you an example?

    In App_Data\Configuration\Telerik.Sitefinity.Configuration.ControlsConfig.xml for catch my ForumControlPanelCustom?

    Thanks
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    27 Nov 2009
    Link to this post
    Hi Pablo Pérez Sánchez,

    "You need to create a custom class that inherits from Forum's ControlPanel.". You cannot work with Telerik.Sitefinity.Configuration.ControlsConfig.xml because the templates for Forums module are not embedded. They are located under Sitefinity/Admin/ControlTemplates/Forums and Sitefinity/ControlTemplates/Forums

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  7. xax_007
    xax_007 avatar
    55 posts
    Registered:
    24 Jul 2009
    27 Nov 2009
    Link to this post
    Hello

    I insert codebehind for ascx, and work correctly, only that save twice, one my ascx.cs and other the telerik code asociated to template, can I inhability the second option?

    Thanks for reply

    Salu2,
    Pablo
  8. xax_007
    xax_007 avatar
    55 posts
    Registered:
    24 Jul 2009
    27 Nov 2009
    Link to this post
    Why to create forum by code I haven´t got option for Author?
  9. xax_007
    xax_007 avatar
    55 posts
    Registered:
    24 Jul 2009
    27 Nov 2009
    Link to this post
    ok, not have this option, is the last post, sorry
Register for webinar
9 posts, 0 answered