Ticket T262465
Visible to All Users
Duplicate

Web Shortcut Javascript Not Firing When ASPxDateTimePropertyEditor Has Focus

created 10 years ago

Hello DevExpress,

My goal is to provide a web shortcut solution based upon S18977. Specifically, I want to be able to execute WebModificationsController "Cancel" action when the user clicks the "Escape" key.

My solution is working in all tested scenarios, except for when a property with an ASPxDateTimePropertyEditor has focus.

I have attached a project which illustrates my problem. In this project, you will find that the cancel action is executed in edit mode if the "StringProperty" editor has focus or if no editor has focus. However, if the "DateProperty" editor (which is a ASPxDateTimePropertyEditor instance) has focus then the cancel action is not executed.

Can you please investigate and let me know if a solution is possible?

Thanks!

Cheers,

Geoff.

Answers approved by DevExpress Support

created 10 years ago (modified 10 years ago)

Hello Geoff,

The issue occurs because of the specifics of the ASPxDateEdit control. It handles the Esc key press to close the date picker dropdown. To resolve the issue, handle the KeyDown client-side event of this control individually, as shown below:

Visual Basic
Private Sub CurrentRequestWindow_PagePreRender(ByVal sender As Object, ByVal e As EventArgs) If IsSuitableViewDetailView() Then ... For Each datePropertyEditor As ASPxDateTimePropertyEditor In CType(Frame.View, DetailView).GetItems(Of ASPxDateTimePropertyEditor)() datePropertyEditor.Editor.ClientSideEvents.KeyDown = "function(s, e) {" & ControlChars.CrLf & _ " if (e.htmlEvent.keyCode == 27) { //Escape" & ControlChars.CrLf & _ " RaiseXafCallback(globalCallbackControl, 'WebShortcutController', 'CancelAction', '', false);" & ControlChars.CrLf & _ " }" & ControlChars.CrLf & _ " }" Next End If End Sub
    Comments (1)

      Hi Anatol,
      Thanks for the excellent solution. It worked the first time!
      Cheers,
      Geoff.

      Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

      Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.