$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
How to put up Command of Dock Using C#
Home > How to > Dock Command
What is dock element command? The button icons that are located in the top right corner of the dock control title bar are the visual displaying format of the dock commands. And by clicking these command icons, users can perform some functions toward the PerDock Control.

How to Add Built-in Commands in C# Code

The built-in commands refer to those default commands which will conduct some functions without any external programming. In this section, we will introduce several supported built-in dock commands.
  • None: if you set the command property to None, there will be no command icon appearing on the PerDock title bar.
  • None: if you set the command property to None, there will be no command icon appearing on the PerDock title bar.
  • Close: after you set the DefaultCommands property to close, there will be a command icon, similar to a deletion sign, showing in the PerDock title bar. The PerDock control will exit from the web page once the user click this Close command icon.
  • PinUnpin: there will be a single Pin command icon on the dock title bar when the PerDock Control is unpinned. And the PerDock control can not be dragged if you click the Pin command icon. There will be a single Unpin command icon on the dock title bar when the PerDock Control is pinned. And the PerDock control can be movable if you click the Unpin command icon.
  • All: if you set the DefaultCommands property to All, then all these built-in command icons will be showed on the dock title bar (Pin or Unpin icon, followed by Collapse or Expand icon and followed by the Close icon.)
Here we attach a programming example which aims to show you how to use one of these supported built-in commands in C# .NET code.
PerDock1.DefaultCommands = DefaultCommands.Close | DefaultCommands.ExpandCollapse;

How to Use Custom Commands in C# Code

If above built-in commands can not meet your needs, you can add your own command to the dock title bar by using the Command property. Following sample code will show you how to add custom command to the PerDock control.

C# Code

DockCommand customCommand = new DockCommand();
customCommand.Name = "Simple Custom Command";
customCommand.Text = "Simple Custom Command";
customCommand.OnClientCommand = "CustomCommand";
customCommand.AutoPostBack = true;
PerDock3.Commands.Add(customCommand);

Javascript Code

<script type="text/javascript">
function CustomCommand(dock, args) {
//You can implement your custom logic in this method
if (!confirm("You clicked " + args.Command.get_name() + ". Do you want to submit the page?")) {
args.set_cancel(true);
}
}
</script>

Related Dock Element Tutorials

Apart from this tutorial page for explaining the dock element command, we also provide developers detailed C# programming guidance on how to customize the settings of another important dock element zone.
ASP.NET AJAX UI Controls