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

Commands not working

3 Answers 78 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 01 Oct 2008, 04:23 PM
Hi

I am trying to fire the dock.Command event put it is not working.

I am building the docklayout zones and docks dynamically....  The docklayout is being placed inside a update panel.

I am using this code to create the docks....

RadDock dock = new RadDock();

dock.ID =

"DockID_" + ControlID.ToString();

dock.Title = ControlName;

dock.AutoPostBack =

true;

dock.Commands.Add(

new DockCloseCommand());

dock.DockPositionChanged +=

new DockPositionChangedEventHandler(dock_DockPositionChanged);

dock.Command +=

new DockCommandEventHandler(dock_Command);

dock.OnClientDragStart =

"StartDrag";

dock.OnClientDockPositionChanged =

"EndDrag";

The dock_Command event never fires.  Any ideas ?

Cheers

3 Answers, 1 is accepted

Sort by
0
Petko
Telerik team
answered on 02 Oct 2008, 12:47 PM
Hi Michael,

All you need to do is to set:
 
command.AutoPostBack =
true;

Keep in mind, that if you want to create RadDock controls dynamically you should do it in the Init event of the page, in order to allow the RadDockLayout to automatically manage their positions. You could create RadDock controls in other events, but you should recreate them in the Init event when the next postback or AJAX request occurs.

The code bellow will collapse RadDock once you click the command:

protected override void OnInit(EventArgs e)  
    {  
        base.OnInit(e);  
 
        RadDock dock = new RadDock();  
        dock.ID = "RadDock1";  
        dock.Title = "Title";  
        dock.Text = "DockText";  
        dock.AutoPostBack = true;  
 
        DockCommand com = new DockCommand();  
        dock.Commands.Add(com);  
        dock.Command += new DockCommandEventHandler(comHandler);  
        com.AutoPostBack = true;  
 
        form1.Controls.Add(dock);  
    }  
     
    void comHandler(object sender, DockCommandEventArgs e)  
    {  
        RadDock dock = (RadDock)sender;  
        dock.Collapsed = true;  
    } 
Let us know if you need further assistance.


Sincerely yours,
Petko
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Michael
Top achievements
Rank 1
answered on 02 Oct 2008, 03:22 PM
Thanks for your reply...

I can now capture the custom event...

How do I capture the close event?

When I click on the X the dock dissapears without posting back...

Cheers


0
Michael
Top achievements
Rank 1
answered on 02 Oct 2008, 03:25 PM
...ignore this...I have sorted it...

Thanks :)
Tags
Dock
Asked by
Michael
Top achievements
Rank 1
Answers by
Petko
Telerik team
Michael
Top achievements
Rank 1
Share this question
or