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

[Solved] Dynamic Dock with Custom commands

1 Answer 80 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Bertrand
Top achievements
Rank 1
Bertrand asked on 08 Sep 2009, 08:06 PM

Hi.
I am trying to combine 2 of your demo:
1) Dynamic dock
2) Custom commands

there is 2 problem:
1- after creating dynamicly a dock, the extra command button is not showed (only the 2 default one)
2 - If i fully reload the page, i can now see the custom button but the command is not trigger!

This is the code... Am i missing somethig?
if I am removing last dock.Commands.Add(d), everything works fine.

Can you help Me!

private RadDock CreateRadDockFromState(DockState state)

{

RadDock dock = new RadDock();

dock.DockMode = DockMode.Docked;

dock.ID = string.Format("RadDock{0}", state.UniqueName);

dock.ApplyState(state);

dock.Commands.Add(new DockCloseCommand());

dock.Commands.Add(new DockExpandCollapseCommand());

DockCommand d = new DockCommand();

d.AutoPostBack = true;

d.Name = "Custom Command";

dock.Commands.Add(d);

return dock;

}

protected void RadDock_Command(object sender, DockCommandEventArgs e)

{

String a = string.Concat("You clicked: ", e.Command.Name);

}

 

 


 

 

 

 

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Bertrand
Top achievements
Rank 1
answered on 09 Sep 2009, 02:43 PM
Found my problem.

1. Add the creation of the custom buttom in the add Dock procedure
2. Add command at the dock command level.

 

private RadDock CreateRadDockFromState(DockState state)

 

{

 

RadDock dock = new RadDock();

 

dock.Command +=

this.RadDock_Command; ***** I  FORGOT this Line*************

 

dock.DockMode =

DockMode.Docked;

 

dock.ID =

string.Format("RadDock{0}", state.UniqueName);

 

dock.ApplyState(state);

dock.Commands.Add(

new DockCloseCommand());

 

dock.Commands.Add(

new DockExpandCollapseCommand());

 

 

DockCommand d = new DockCommand();

 

d.AutoPostBack =

true;

 

d.Name =

"Custom Command";

 

dock.Commands.Add(d);

 

return dock;

 

}

 

protected void RadDock_Command(object sender, DockCommandEventArgs e)

 

{

 

String a = string.Concat("You clicked: ", e.Command.Name);

 

}

 


Tags
General Discussions
Asked by
Bertrand
Top achievements
Rank 1
Answers by
Bertrand
Top achievements
Rank 1
Share this question
or