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

Pause user from Closing multiple docks

1 Answer 33 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Bobby
Top achievements
Rank 1
Bobby asked on 21 Jan 2009, 09:47 PM
I have an issue with the dock command.Name="close".
If the user clicks the close button quickly on multiple docks, it will not have enough time to finish the process before skiping on over to the next dock. How can I prevent the user from clicking the close button or make the sub finish on process before starting another.

Thank you
Bobby

 

   Sub dock_Command(ByVal sender As Object, ByVal e As DockCommandEventArgs)  
 
        If e.Command.Name = "ExpandCollapse" Then  
            'Update record in database if dock is collapsed  
            UpdateRec((DirectCast(sender, RadDock)).Title, (DirectCast(sender,RadDock)).DockZoneID, (DirectCast(sender, RadDock)).Collapsed.ToString)  
        End If  
 
 
 
 
        If e.Command.Name = "Close" Then  
 
 
 
            Dim DelDock As String = (DirectCast(sender, RadDock)).Title  
 
 
            DeleteRec(Profile.UserName, DelDock.ToString)  
 
    
            Dim i As Integer  
            For i = 0 To Me.combolist.Items.Count - 1  
                If combolist.Items(i).Text = DelDock.ToString Then  
                    combolist.Items(i).Enabled = True 
                    Dim j As Integer  
                    For j = 0 To arr.Count - 1  
                        If arr(j).ToString = combolist.Items(i).Value.ToString Then  
                            ' Label1.Text += arr(j).ToString  
                            arr.RemoveAt(j)  
 
                            Exit For  
                        End If  
                    Next  
                    Exit For  
                End If  
            Next  
 
 
            Dim z As Integer  
 
            If (DirectCast(sender, RadDock)).DockZoneID = "RadDockZone1" Then  
 
                'Reorder docks Index for DockZone 1  after deletion  
                For z = 0 To Me.RadDockZone1.Docks.Count - 1  
                    UpdateIndex(Me.RadDockZone1.Docks(z).Title, "RadDockZone1", z.ToString)  
                Next  
            Else  
                'Reorder docks Index for DockZone 2 after deletion  
                For z = 0 To Me.RadDockZone2.Docks.Count - 1  
                    UpdateIndex(Me.RadDockZone2.Docks(z).Title, "RadDockZone2", z.ToString)  
                Next  
            End If  
 
            ScriptManager.RegisterStartupScript(UpdatePanel1, Me.[GetType](), "RemoveDock", String.Format("function _removeDock() {{" & Chr(13) & "" & Chr(10) & "" & Chr(9) & "Sys.Application.remove_load(_removeDock);" & Chr(13) & "" & Chr(10) & "" & Chr(9) & "$find('{0}').undock();" & Chr(13) & "" & Chr(10) & "" & Chr(9) & "$get('{1}').appendChild($get('{0}'));" & Chr(13) & "" & Chr(10) & "" & Chr(9) & "$find('{0}').doPostBack('DockPositionChanged');" & Chr(13) & "" & Chr(10) & "}};" & Chr(13) & "" & Chr(10) & "Sys.Application.add_load(_removeDock);", (DirectCast(sender, RadDock)).ClientID, UpdatePanel1.ClientID), True)  
 
        End If  
 
    End Sub 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Nikolay Raykov
Telerik team
answered on 26 Jan 2009, 09:21 AM
Hi Bobby,

You could set the CommandsAutoPostBack property to false in order to prevent postback when the user clicks on the command icon. This way the command event handler would be called only when a postback is made by another control on the page and you will be able to execute your code for all docks.

If you prevent the default behavior when clicking on a command icon you will in fact degrade the user experience because when you click on the icon some action should take place. But if you want to prevent the users from clicking on the command icons you could attach an onclick event handler to the commands container of the dock. The code below shows how to get the commands container:

var commandsContainer = dock.get_commandsContainer(); 

I hope this helps. If you have further questions, please, feel free to contact us at any time.

Best wishes,
Nikolay Raykov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Dock
Asked by
Bobby
Top achievements
Rank 1
Answers by
Nikolay Raykov
Telerik team
Share this question
or