DockPositionChanged Not firing Always

6 posts, 0 answers
  1. Roiy
    Roiy avatar
    12 posts
    Member since:
    May 2008

    Posted 05 Jun 2008 Link to this post

    Hi,

    We are implementing a Portal page similar to the myportal sample, we are perstiting the layout to database. When moving a dock which is at the top of the Zone, the dock beneath changes position but no event is fired, thus putting him out of sync.When we reload the layout from DB an exception is thrown.
    Any Ideas why the DockPositionChanged is not getting fired?
  2. Sophy
    Admin
    Sophy avatar
    636 posts

    Posted 05 Jun 2008 Link to this post

    Hi Roiy,

    I would  like to ask you clarify a little bit the issue you experience. What do you mean under  "the dock beneath"? Is this another dock different from the one you move? How its position is changed? Do you change it with code? If you want to fire the DockPositionChanged server-side event when moving a dock make sure that you have set its AutoPostback property to true. Please, refer to the the DockPositionChanged help article for detailed information when this event gets fired. Information about the corresponding client-side event you can find in the OnClientDockPositionChanged help article.
    In case the above suggestions cannnot help you solve the issue, please, send us a simple running application which reproduces the problem so that we can test it locally and research the problem. You will need to open a support ticket in order to have the right to attach files. Please, download a trial version of the RadControls for ASP.NET AJAX suite and you will have the right to open a support ticket. For your convenience I have attached a screenshot with instructions how to open a support ticket.

    Best regards,
    Sophy
    the Telerik team

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

    Posted 05 Jun 2008 Link to this post

    I will clear show what i mean,
    I have 3 zones and i am dynamicly creating the dock in my code.
    See Code below:
    aDock.DockMode = DockMode.Docked;  
                aDock.AutoPostBack = true;  
                aDock.CommandsAutoPostBack = true;  
                aDock.Collapsed = !widg.Expanded;  
                //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 DockPositionChangedtriger = new AsyncPostBackTrigger();  
                DockPositionChangedtriger.ControlID = aDock.ID;  
                DockPositionChangedtriger.EventName = "DockPositionChanged";  
                UpdatePanel1.Triggers.Add(DockPositionChangedtriger);  
     
                AsyncPostBackTrigger Commandtriger = new AsyncPostBackTrigger();  
                Commandtriger.ControlID = aDock.ID;  
                Commandtriger.EventName = "Command";  
                UpdatePanel1.Triggers.Add(Commandtriger);  
     
                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;  
                } 
    void aDock_Command(object sender, DockCommandEventArgs e)  
            {  
                if (sender is RadDock)  
                {  
                    int Id = Convert.ToInt32(((RadDock)sender).ID);  
                    bool isCollapsed = ((RadDock)sender).Collapsed;  
                    if (e.Command.Name.CompareTo("Close") == 0)  
                    {//close command  
                        DashboardWorkflow.RemoveWidget(Id);  
                    }  
                    else  
                    {//expand/collapse command  
                        DashboardWorkflow.SaveWidgetState(Id, !isCollapsed);  
                    }  
                }  
            }  
     
            void aDock_DockPositionChanged(object sender, DockPositionChangedEventArgs e)  
            {  
                  
                if (sender is RadDock)  
                {  
                    int Id = Convert.ToInt32(((RadDock)sender).ID);  
                    Enums.DockZones zone = (Enums.DockZones)Enum.Parse(typeof(Enums.DockZones), e.DockZoneID);  
                    DashboardWorkflow.MoveWidget(Id, (int)zone, e.Index);  
                }  
            } 
    if i move a dock between zone the event DockPositionChanged is fired
    for this part everything works fine. my problem  start if i have 2 docks in one zone (in index 0 and 1) if i move the top dock(index 0) to other zone the event is fired for the dock i just move(index 0) but the second dock is moving up to index 0 and for him the event isn't fired.
    same thing happens if i remove the top dock-the remaining one moves up but the event isn't fired.
  4. Sophy
    Admin
    Sophy avatar
    636 posts

    Posted 05 Jun 2008 Link to this post

    Hello Roiy,

    Thank you for clarifying the issue.
    The behavior you observe is normal. When you drag a dock from one zone to another one the DockPositionChanged event is not fired for the docks which remain in the first zone. However, if you move a dock to a zone in which there are other docks and you place the dragged dock not at the end of the zone but somewhere between the other docks or before them some or all of the docks will change their positions and the DockPositionChanged event will be fired for them.
    If you have other questions, do contact us again.

    All the best,
    Sophy
    the Telerik team

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

    Posted 10 Jun 2008 Link to this post

    Hi
    Thanks for the reply
    you wrote:  "The behavior you observe is normal. When you drag a dock from one zone to another one the  event is not fired for the docks which remain in the first zone" but this is in consistent because if you move a dock to a zone  in which there are other docks and you place the dragged dock in the top of the zone, the other dock change index(move down from 0 to 1) and for it the event is fired.
    So if  you have 2 docks in one zone and you move the top one ,the docks which remain change it index (from 1 to 0) so the event should be fired as well.
    And because the event is not fired the index are not correct

    Thanks

    roiy
  6. Petio Petkov
    Admin
    Petio Petkov avatar
    825 posts

    Posted 18 Jun 2008 Link to this post

    Hello Roiy,

    By design this event is created to be fired as Sophy explains. You have a good point here however and I agree with you - I logged this as a feature request for future reconsideration and implementation.

    Your points were updated.


    All the best,
    Petio Petkov
    the Telerik team

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