Dynamically created Docks

3 posts, 2 answers
  1. Roiy
    Roiy avatar
    12 posts
    Member since:
    May 2008

    Posted 04 Jun 2008 Link to this post

    Hi
    Im trying to create docks and I need some help.
    my code :
    RadDock aDock = ((IWidget)(auserControl)).GetWidget();  
                    aDock.DockMode = DockMode.Docked;  
                    aDock.AutoPostBack = true;  
                    aDock.CommandsAutoPostBack = true;  
                      
                    //Add closed command  
                    DockCloseCommand dCC = new DockCloseCommand();  
                    dCC.AutoPostBack = true;  
                    aDock.Commands.Add(dCC);  
     
                    //Add DockExpandCollapseCommand  
                    DockExpandCollapseCommand dEC = new DockExpandCollapseCommand();  
                    dEC.AutoPostBack = true;  
                    aDock.Commands.Add(dEC);  
     
                    aDock.DockPositionChanged += new DockPositionChangedEventHandler(aDock_DockPositionChanged);  
                    aDock.Command += new DockCommandEventHandler(aDock_Command);  
                    aDock.ID = widg.Id.ToString();  
                    AsyncPostBackTrigger triger = new AsyncPostBackTrigger();  
                    triger.ControlID = aDock.ID;  
                    triger.EventName = "DockPositionChanged";  
                    UpdatePanel1.Triggers.Add(triger);  
                    switch (widg.ColumnNo)  
                    {  
                        case 1:  
                            DockZoneLeft.Controls.AddAt(widg.OrderNo, aDock);  
                            break;  
                        case 2:  
                            DockZoneMid.Controls.AddAt(widg.OrderNo, aDock);  
                            break;  
                        case 3:  
                            DockZoneRight.Controls.AddAt(widg.OrderNo, aDock);  
                            break;  
                    } 
     thats work fine
    the part that i need help is this
    void aDock_Command(object sender, DockCommandEventArgs e)  
            {  
            }  
     void aDock_DockPositionChanged(object sender, DockPositionChangedEventArgs e)  
            {  
                  
            } 
    each time the user move/remove/expand/collaps the dock i need to save it in the DB so in  aDock_DockPositionChanged   i need the radock id (i have the e.dockzonid and e.index for location)
    and in aDock_Command i need the radock id and if the action is expand or collaps.
    i cant get it from e or sender ,any other idea?

    Thanks
    Roiy

  2. Answer
    Sophy
    Admin
    Sophy avatar
    636 posts

    Posted 05 Jun 2008 Link to this post

    Hi Roiy,

    In both handlers (aDock_Command and aDock_DockPositionChanged) the first parameter - object sender is the corresponding dock which has raised the event. You can find the id of the dock in the following way:
    string id = ((Control)sender).ID;
    You can take a look the the AutoPostBack online example for reference.
    If you need further assistance, do contact us again.

    Best wishes,
    Sophy
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Answer
    Roiy
    Roiy avatar
    12 posts
    Member since:
    May 2008

    Posted 05 Jun 2008 Link to this post

    Thanks
Back to Top