event for expand/collapse

4 posts, 0 answers
  1. Bob Duffy
    Bob Duffy avatar
    1 posts
    Member since:
    Mar 2007

    Posted 21 Aug 2007 Link to this post

    Hi,

    Is it possibel to get an event for expand/collapse of docking control. I want to save the state when this happens.

    Regards,
    Bob
  2. Petya
    Admin
    Petya avatar
    869 posts

    Posted 22 Aug 2007 Link to this post

    Hello Bob Duffy,

    The server-side event that is raised is Command. You can handle it the following way:

    1. Attach a handler in code-behind:

    dock1.Command += new DockCommandEventHandler(dock_Command);

    OR

    attach a handler in ASPX:

    <telerik:raddock id="dock1" runat="server" defaultcommands="ExpandCollapse" oncommand="dock_Command">
    </telerik:raddock>

    2. Handle the Command

    void dock_Command(object sender, DockCommandEventArgs e)
    {
             if(e.Command.Name == "ExpandCollapse")
             {    
                  //your logic here
             }

    }

    Make sure you set CommandsAutoPostback="true" so that upon clicking Collapse/Expand a postback wll be initiated.

    You can also handle the command client-side by specifying the OnClientCommand property of RadDock. Let me know if you need further assistance with this.

    Regards,
    Petya
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Jesper Broe Rasmussen
    Jesper Broe Rasmussen avatar
    33 posts
    Member since:
    Mar 2007

    Posted 21 Sep 2007 Link to this post

    I have a similiar problem here. I get a visible post (the page flickers) but the event method newDock_Command() is never executed...

    Telerik.Web.UI.RadDock newDock = new Telerik.Web.UI.RadDock();

    newDock.ID = "contactDock_" + currentContact.Account;

    newDock.Title = "Kalender - " + currentContact.Cn;

    newDock.AutoPostBack = true;

    newDock.Command += new Telerik.Web.UI.DockCommandEventHandler(newDock_Command);

    newDock.CommandsAutoPostBack = true;

    Telerik.Web.UI.DockCloseCommand closeCommand = new Telerik.Web.UI.DockCloseCommand();

    closeCommand.AutoPostBack = true;

    newDock.Commands.Add(closeCommand);

    newDock.Commands.Add(new Telerik.Web.UI.DockExpandCollapseCommand());



    protected void newDock_Command(object sender, Telerik.Web.UI.DockCommandEventArgs e)

    {

    if (e.Command.Name.ToUpper() == "CLOSE")

    {

    this.uxRadDockZone.Controls.Remove((Control)sender);

    }

    }

  4. Petya
    Admin
    Petya avatar
    869 posts

    Posted 24 Sep 2007 Link to this post

    Hi Jesper Broe Rasmussen,

    As you can see in our online demos the exact same scenario works as expected. Please, review them carefully comparing your code to the one in the demos. If you continue to experience the same problem, please open a support ticket as demonstrated in the attached instructions and send us a simple running project demonstrating the issue you experience so we can work on it and provide more accurate assistance.

    Regards,
    Petya
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top