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

Forums / Developing with Sitefinity / How command panel retrieve available views from control panel

How command panel retrieve available views from control panel

7 posts, 1 answered
  1. CafeDelMar
    CafeDelMar avatar
    28 posts
    Registered:
    06 May 2007
    28 Jan 2011
    Link to this post
    Dear Telerik Team

    How command panel retrieve available views from its control panel?
    My purpose is get all views from whole hirarcy (from top level to low level) and implement it in radpanelbar as menu of view command in Custom Command Panel

    I've try to debug this code below but this.host always return null

    protected override void InitializeControls(System.Web.UI.Control viewContainer)
           {
               foreach (KeyValuePair<Type,Telerik.Cms.Web.UI.IViewInfo> view in this.host.Views)
               {
     
               }
           }


    Thanks
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    31 Jan 2011
    Link to this post
    Hi CafeDelMar,

    The ViewModelControl has a property  IDictionary<Type, IViewInfo> Views which you can use to get the commands in your custom ControlPanel

    foreach (var viewInfo in this.Views.Values)
    {
    }


    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. CafeDelMar
    CafeDelMar avatar
    28 posts
    Registered:
    06 May 2007
    31 Jan 2011
    Link to this post
    Hi Ivan
    Thanks for your quick response

    Is it possible to implement that code in custom command panel class? because this.Host always return null
    CommandPanel.cs
    public class CommandPanel : Telerik.Cms.Web.UI.ViewModeControl<ControlPanel>,Telerik.Web.ICommandPanel
    {
    ....
    protected override void InitializeControls(System.Web.UI.Control viewContainer)
    {
    foreach (var viewInfo in this.Host.Views.Values)
    {
    }
    ...
    }

    ControlPanel.cs
    public class ControlPanel : Telerik.Cms.Web.UI.Backend.ProviderControlPanel<ControlPanel>
     {
    ....
    protected override void CreateCustomCommandPanels(string viewMode, List<Telerik.Web.ICommandPanel> list)
            {
                list.Add(new CommandPanel(this));
            }
    .....
    }

    Thanks
  4. CafeDelMar
    CafeDelMar avatar
    28 posts
    Registered:
    06 May 2007
    01 Feb 2011
    Link to this post
    Dear Telerik Team
    any comment for my issue please?
    Thanks
  5. CafeDelMar
    CafeDelMar avatar
    28 posts
    Registered:
    06 May 2007
    01 Feb 2011
    Link to this post
    Dear all
    anyone can help me?

    Thanks
  6. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    08 Feb 2011
    Link to this post
    Hello CafeDelMar,

    You should get the child views after the base.CreateChildcontrols method has been executed. What you can do is to override CreateChildControls method. Call the base implementation and then check the child views.

    Greetings,
    Radoslav Georgiev
    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
    Answered
  7. CafeDelMar
    CafeDelMar avatar
    28 posts
    Registered:
    06 May 2007
    10 Feb 2011
    Link to this post
    Hi
    Radoslav Georgiev

    Thanks for ur answer and i found this blog How to get reference to Control Panel from Command Panel (Building Modules)

    Regards
Register for webinar
7 posts, 1 answered