Sitefinity CMS

Telerik.Framework Send comments on this topic.
CommandPanelBase Class
See Also  Members   Example 
Telerik.Web Namespace : CommandPanelBase Class


Base class for command panel controls. Implements the ICommandPanel interface.

 

Namespace: Telerik.Web
Assembly: Telerik.Framework (in Telerik.Framework.dll)

Syntax

Visual Basic (Declaration) 
Public MustInherit Class CommandPanelBase 
   Inherits CompositeControl
   Implements ICommandPanel 
Visual Basic (Usage)Copy Code
Dim instance As CommandPanelBase
C# 
public abstract class CommandPanelBase : CompositeControl, ICommandPanel  

Example

The following example provides sample implementation of the CommandPanelBase class. It uses the base constructor to assign the ControlPanel control to which the ToolBoxPanel is connected. In the button event it calls the ControlPanel control and changes its mode so that controls corresponding to it could be rendered (See ControlPanelBase class for more information)
C#Copy Code
public class ToolBoxPanel : CommandPanelBase
{
   
public ToolBoxPanel(ControlPanel panel)
       :
base(panel)
   {
   }

   
protected override void CreateChildControls()
   {
       
this.Controls.Clear();

       HtmlGenericControl p =
new HtmlGenericControl("p");
       HtmlGenericControl strong =
new HtmlGenericControl("strong");
       strong.InnerText =
"Select mode:";
       p.Controls.Add(strong);
       
this.Controls.Add(p);

       HtmlGenericControl div =
new HtmlGenericControl("div");

       LinkButton btnCategory =
new LinkButton();
       btnCategory.ID =
"btnCategory";
       btnCategory.Text = Messages.ViewCategories;
       btnCategory.Style.Add(
"display", "block");
       div.Controls.Add(btnCategory);

       LinkButton btnType =
new LinkButton();
       btnType.ID =
"btnType";
       btnType.Text = Messages.ViewTypes;
       btnType.Style.Add(
"display", "block");
       div.Controls.Add(btnType);
       
this.Controls.Add(div);

       btnCategory.CommandName =
"ShowCategories";
       btnCategory.Command +=
new CommandEventHandler(Button_Command);
       btnType.CommandName =
"ShowTypes";
       btnType.Command +=
new CommandEventHandler(Button_Command);
   }

   
void Button_Command(object sender, CommandEventArgs e)
   {
       
switch (e.CommandName)
       {
           
case "ShowCategories":
               
//Set the mode in the ControlPanel to display the job category data.
               
((ControlPanel)base.ControlPanel).SetMode(DisplayMode.CategoriesList);
               
break;
           
case "ShowTypes":
               
//Set the mode in the ControlPanel to display the job type data.
               
((ControlPanel)base.ControlPanel).SetMode(DisplayMode.TypesList);
               
break;
       }
   }
}
    

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also