How would you create a command clientside in the dock bar?

2 posts, 0 answers
  1. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 23 Jan 2011 Link to this post

    I am unable to add the command in the serverside code, but I can attach to the dock item clientside.

    Is there some function to add a new command item?  I can't see how I would do that in the docs
  2. Pero
    Pero avatar
    1156 posts

    Posted 25 Jan 2011 Link to this post

    Hi Steve,

    By default the dock commands cannot be created on the client, but with custom JavaScript code a command this can be achieved. Here is an example

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <head runat="server">
        <form id="form1" runat="server">
        <asp:ScriptManager ID="RadScriptManager1" runat="server">
        <script type="text/javascript">
            function CreateClick()
                var dock = $find("RadDock1");
                var li = document.createElement("li");
                var anchor = document.createElement("a");
                anchor.setAttribute("title", "Command Text");
                var span = document.createElement("span");
                Sys.UI.DomElement.addCssClass(span, "rdCustom");
                var command = $create(Telerik.Web.UI.DockCommand, null, null, null, anchor);
                command.radDock = dock;
                dock.get_commands()["CommandName"] = command;
            <input type="button" onclick="CreateClick();" value="Add Command" />
            <telerik:RadDockLayout ID="RadDockLayout1" runat="server">
                <telerik:RadDockZone ID="RadDockZone1" runat="server" MinHeight="300px" Width="300px">
                    <telerik:RadDock ID="RadDock1" runat="server" Title="RadDock-Title" Width="300px"
                            <telerik:DockCloseCommand />

    All the best,
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  3. DevCraft R3 2016 release webinar banner
Back to Top