Pause user from Closing multiple docks

2 posts, 0 answers
  1. Bobby
    Bobby avatar
    1 posts
    Member since:
    Jan 2009

    Posted 21 Jan 2009 Link to this post

    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

     

    1    Sub dock_Command(ByVal sender As Object, ByVal e As DockCommandEventArgs)  
    2  
    3         If e.Command.Name = "ExpandCollapse" Then  
    4             'Update record in database if dock is collapsed  
    5             UpdateRec((DirectCast(sender, RadDock)).Title, (DirectCast(sender,RadDock)).DockZoneID, (DirectCast(sender, RadDock)).Collapsed.ToString)  
    6         End If  
    7  
    8  
    9  
    10  
    11         If e.Command.Name = "Close" Then  
    12  
    13  
    14  
    15
    16             Dim DelDock As String = (DirectCast(sender, RadDock)).Title  
    17  
    18  
    19             DeleteRec(Profile.UserName, DelDock.ToString)  
    20  
    21     
    22             Dim i As Integer  
    23             For i = 0 To Me.combolist.Items.Count - 1  
    24                 If combolist.Items(i).Text = DelDock.ToString Then  
    25                     combolist.Items(i).Enabled = True 
    26                     Dim j As Integer  
    27                     For j = 0 To arr.Count - 1  
    28                         If arr(j).ToString = combolist.Items(i).Value.ToString Then  
    29                             ' Label1.Text += arr(j).ToString  
    30                             arr.RemoveAt(j)  
    31  
    32                             Exit For  
    33                         End If  
    34                     Next  
    35                     Exit For  
    36                 End If  
    37             Next  
    38  
    39  
    40             Dim z As Integer  
    41  
    42             If (DirectCast(sender, RadDock)).DockZoneID = "RadDockZone1" Then  
    43  
    44                 'Reorder docks Index for DockZone 1  after deletion  
    45                 For z = 0 To Me.RadDockZone1.Docks.Count - 1  
    46                     UpdateIndex(Me.RadDockZone1.Docks(z).Title, "RadDockZone1", z.ToString)  
    47                 Next  
    48             Else  
    49                 'Reorder docks Index for DockZone 2 after deletion  
    50                 For z = 0 To Me.RadDockZone2.Docks.Count - 1  
    51                     UpdateIndex(Me.RadDockZone2.Docks(z).Title, "RadDockZone2", z.ToString)  
    52                 Next  
    53             End If  
    54  
    55             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)  
    56  
    57         End If  
    58  
    59     End Sub 

     

     

     

  2. Nikolay Raykov
    Admin
    Nikolay Raykov avatar
    102 posts

    Posted 26 Jan 2009 Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top