Skip to main content

ASPxClientGridView.RowClick Event

Fires when a user clicks a data row.

Declaration

RowClick: ASPxClientEvent<ASPxClientGridViewRowClickEventHandler<ASPxClientGridView>>

Event Data

The RowClick event's data class is ASPxClientGridViewRowClickEventArgs. The following properties provide information specific to this event:

Property Description
cancel Specifies whether to cancel the related action (for example, row edit, export). Inherited from ASPxClientCancelEventArgs.
htmlEvent Provides access to the parameters associated with the ASPxClientGridView.RowClick event.
visibleIndex Gets the processed row’s visible index. Inherited from ASPxClientGridViewRowCancelEventArgs.

Remarks

The control raises the client-side RowClick event when a user clicks a data row.

The code sample below allows you to handle the RowClick and RowDblClick events to perform custom operations on single and double row clicks.

View Example: Grid View for ASP.NET Web Forms - How to use both the RowClick and RowDoubleClick events.

<dx:ASPxGridView ID="ASPxGridView1" KeyFieldName="CategoryID" runat="server" AutoGenerateColumns="False">
    <Columns>
        <dx:GridViewDataTextColumn FieldName="CategoryID" VisibleIndex="0" ReadOnly="True" />
        <dx:GridViewDataTextColumn FieldName="CategoryName" VisibleIndex="1" />
        <dx:GridViewDataTextColumn FieldName="Description" VisibleIndex="2" />
    </Columns>
    <SettingsBehavior AllowFocusedRow="true" />
    <ClientSideEvents RowClick="OnRowClick" RowDblClick="OnRowDblClick"/>
</dx:ASPxGridView>
var doProcessClick;
var visibleIndex;

function ProcessClick() {
    if(doProcessClick) {
        alert("Here is the RowClick action in the " + visibleIndex.toString() + "-th row");
    }
}

function OnRowClick(s, e) {
    doProcessClick = true;
    visibleIndex = e.visibleIndex + 1;
    window.setTimeout(ProcessClick, 500);
}

function OnRowDblClick(s, e) {
    doProcessClick = false;
    var key = s.GetRowKey(e.visibleIndex);
    alert('Here is the RowDoubleClick action in a row with the Key = ' + key);
}
See Also