Ticket T280480
Visible to All Users

Handle Client-Side Events of DevExpress ASP.NET controls in XAF

created 10 years ago

Hello DevExpress,

this article describes how to write client side event handlers for ASPx controls in web applications. Is there any way to use this for ASPx controls of custom view items in a XAF web application, and if so, how to do it?

Thank you,
  Andreas

Answers approved by DevExpress Support

created 10 years ago

Hello Andreas,

You can assign client-side event handlers in XAF in the same manner:

C#
MyMenu.ClientSideEvents.ItemClick = "function(s, e) { alert(s.name); }"; MyMenu.ClientSideEvents.Init = "MyFunction";

In addition, see an example of how to define client-side event handlers for built-in controls: How to highlight the focused editor in DetailView

Let me know if you need further assistance.

    Comments (2)

      Hello Anatol,
      thank you very much for your quick reply. It took me a bit further, but unfortunately I´m still having a hard time trying to get behind all this, so thank´s in advance for your patience!
      I have attached a little demo XAF project to show what I would like to do. It contains a XAF DashboardView with a custom ViewItem. This item contains one control: an ASPxDashboardViewer with a GridDashboardItem. Drilling is enabled for the Grid. I´m using the viewer´s ClientSideEvents.ItemClick, according to your advice, as well as DrillDownPerformed and DrillUpPerformed. The ClientSideEvents.js file handles those events. I implemented a notification that pops up when a row in the grid is clicked at maximum drill level. It´s working fine so far.
      Now, I would like to process information about which item in the grid was clicked. I don´t want to do it in javascript, I would like to do it in C#, since I want to load data from the database, depending on which item was clicked, and then automatically pop up another XAF DashboardView. There is a "Pop up" action that shows that view (it´s empty right now). That view is supposed to show the data loaded from the database, depending on what item was clicked.
      So, basically, I want to catch client events and send their sender and args back to the server for processing. Is there a way to do that?
      Thank you,
       Andreas

      Anatol (DevExpress) 10 years ago

        You can show an XAF View from a client-side script by raising an XAF callback. Please refer to the How to implement the drill-down functionality in Web PivotGrid (ASPxPivotGrid) example, where a similar functionality is implemented.

        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.