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

Forums / Developing with Sitefinity / Setting the "ControlPanelTitle" in a Generic Content module.

Setting the "ControlPanelTitle" in a Generic Content module.

6 posts, 0 answered
  1. Carl
    Carl avatar
    23 posts
    Registered:
    15 Jul 2008
    20 Oct 2008
    Link to this post
    Me again.

    For the most part, my generic module is working. Just going over and touching up the small things (as they say, the devil is in the details).

    One thing I noticed is that when I go to my custom Generic Content module, on the list page it says "Generic Content" in the "ControlPanelTitle" h1 tags. However, when I go to the edit item page, it says "MediaReleases > Media Release #10".

    In the Modules class, I do see that the ControlPanelTitle.InnerText is set to the value of pnl.Title, which is this.contolPanel (by the way, its missing the 'r' in the code). Unfortunately the Title property is read only, and I've tried to set base.tlt and base.titleImpl (which I have no idea what its for).

    So I'm wondering, a) where and how can I set the ControlPanelTitle? and b) where does it grab the value from? I would think that this could be done in the web.config.

    Has anyone ever told you guys, that you're the best?
    Thanks,
    Carl J
  2. Gabe Sumner
    Gabe Sumner avatar
    440 posts
    Registered:
    09 Sep 2007
    20 Oct 2008
    Link to this post
    Hi Carl,

    Others might know the answer to this right-away, but I personally would need to see some code to make sense of what is currently going on.

    Do you a ControlPanel.ascx file for your custom module?  Can you post it?  It might also help to post some of your module code.

    Gabe Sumner


  3. Carl
    Carl avatar
    23 posts
    Registered:
    15 Jul 2008
    21 Oct 2008
    Link to this post
    Hi Gabe,

    My Generic Content module doesn't have a ControlPanel.ascx. The module is based on the "Products Module" from the Sitefinity help, which can be found at http://www.sitefinity.com/help/developer-manual/products-module-simple-implementation.html.

    As for posting code, I'm not really too sure what I can show you that would be useful.

    What I'm wondering is, should the main list page of the Generic Content module display the name of the module at the top of the control panel, instead of "Generic Content"? If I go to Categories or Tags in the module, the title says "MediaReleases > Tags" and "MediaReleases > Categories".

    I just noticed that if I go from either the module's Tags or Categories pages, back to the main page, the title at the top of the control panel says "MediaReleases". So obviously the main page of the module should be displaying the name of the module, except that it doesn't do it when you go to the module via the module link along the top. So something isn't firing properly in Sitefinity when the user first goes into the module.

    I've added the following code to the module's ControlPanel class:
    protected override void CreateChildControls()  
    {  
         base.CreateChildControls();  
         switch (this.Mode)  
         {  
              case Modes.List:  
                   // 'titleImpl'?  
                   base.titleImpl = "1 Media Releases";  
                   break;  
              default:  
                   break;  
         }  
    }  
     

    Again, when first going to the module it displays "Generic Content". However, when I go back and forth between the pages of the module, it will then show "1 Media Releases", "1 Media Releases > Tags" and "1 Media Releases > Categories". This is from the above code.

    So back to my original question. Shouldn't the main page (the one that contains the list of items) of the custom Generic Content module (based on the "Products Module") be displaying the name of the module at the top of the Control Panel by default? I would think that it should be grabbing either from the web.config or from the ModuleName in Messages.resx.

    Thanks again,
    Carl J
  4. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    24 Oct 2008
    Link to this post
    Hi Carl,

    I got your though. Will will try to provide an example on how-to change this this property next week.

    Regards,
    Georgi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    07 Nov 2008
    Link to this post
    Hi Carl,

    To achieve the required functionality, follow the instructions below:
    1. Add the following property in the ProductsManager class:

    ProductsManager.cs
                /// <summary> 
            /// Gets default provider used by products manager. 
            /// </summary> 
            public static string DefaultContentProvider 
            { 
                get 
                { 
                    return ConfigHelper.Handler.DefaultContentProvider; 
                } 
            } 

    2. Override Title property in the ControlPanel:

    ControlPanel.cs
            /// <summary> 
            /// Gets current title of the control panel. 
            /// </summary> 
            public override string Title 
            { 
                get 
                { 
                    if (String.IsNullOrEmpty(titleImpl)) 
                    { 
                        titleImpl = String.IsNullOrEmpty(base.ProviderName) ? 
                            ProductsManager.DefaultContentProvider : base.ProviderName; 
                        titleImpl = titleImpl.Replace('_', ' '); 
                    } 
                    return titleImpl; 
                } 
            } 

    Do let us know if this helps.

    Regards,
    Pepi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  6. Carl
    Carl avatar
    23 posts
    Registered:
    15 Jul 2008
    20 Nov 2008
    Link to this post
    Pepi, you're my hero. Thanks again (:

    Carl J
Register for webinar
6 posts, 0 answered