This is a migrated thread and some comments may be shown as answers.

event for expand/collapse

3 Answers 220 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Bob Duffy
Top achievements
Rank 1
Bob Duffy asked on 22 Aug 2007, 12:57 AM
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

3 Answers, 1 is accepted

Sort by
0
Petya
Telerik team
answered on 22 Aug 2007, 08:27 AM
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
0
Jesper Broe Rasmussen
Top achievements
Rank 1
answered on 21 Sep 2007, 07:48 AM
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);

}

}

0
Petya
Telerik team
answered on 24 Sep 2007, 08:43 AM
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
Tags
Dock
Asked by
Bob Duffy
Top achievements
Rank 1
Answers by
Petya
Telerik team
Jesper Broe Rasmussen
Top achievements
Rank 1
Share this question
or