Skip to main content

ASPxClientUtils.GetEventX(htmlEvent) Method

Gets the x-coordinate of the event-related mouse pointer position relative to an end-user’s screen.

Declaration

static GetEventX(
    htmlEvent: any
): number

Parameters

Name Type Description
htmlEvent any

An object specifying the required HTML event.

Returns

Type Description
number

The x-coordinate of the event-related mouse pointer position relative to an end-user’s screen.

Example

using System;
using DevExpress.Web.ASPxMenu;
using DevExpress.Web.ASPxGridView;
using DevExpress.Web;

public partial class _Default : System.Web.UI.Page {
    protected void Page_Load(object sender, EventArgs e) {
        if(!IsPostBack)
            CreateMenuItems();
        UpdateMenuState();
    }

    protected void CallbackPanel_Callback(object source, CallbackEventArgsBase e) {
        if(e.Parameter.StartsWith("toggle")) {
            string name = e.Parameter.Substring(7);
            GridViewColumn column = Grid.Columns[name];
            if(column == null)
                return;
            column.Visible = !column.Visible;            
        }        
    }

    void CreateMenuItems() {
        for(int i = 0; i < Grid.Columns.Count; i++) {
            GridViewColumn column = Grid.Columns[i];
            GridViewDataColumn dataColumn = column as GridViewDataColumn;
            PopupMenu.Items.Add(dataColumn != null ? dataColumn.FieldName : "#", dataColumn.FieldName);
        }
    }

    void UpdateMenuState() {
        for (int i = 0; i < Grid.Columns.Count; i++) {
            MenuItem item = PopupMenu.Items[i];
            GridViewDataColumn column = Grid.Columns[i] as GridViewDataColumn;            
            item.GroupName = column.FieldName;
            item.Checked = column.Visible;
        }
    }

}
See Also