WebDataSelection Class

Represents selection within the ASPxGridView.

Namespace: DevExpress.Web.Data

Assembly: DevExpress.Web.v19.2.dll

Declaration

public class WebDataSelection :
    WebDataSelectionBase,
    IWebDataSelectAllOwner
Public Class WebDataSelection
    Inherits WebDataSelectionBase
    Implements IWebDataSelectAllOwner

Remarks

The WebDataSelection object is returned by the ASPxGridView.Selection property. It provides multiple methods that enable you to select or deselect individual data rows displayed within the ASPxGridView. To select all rows, use the WebDataSelection.SelectAll method. To clear a selection, use the WebDataSelection.UnselectAll method. To identify whether the specified row is selected, use the GridViewSelection.IsRowSelected method.

For more information, see Selection.

Examples

This example illustrates how to dynamically display a focused employee's photo and details outside the grid.

In the example, handle the ASPxClientGridView.FocusedRowChanged event to call the OnGridFocusedRowChanged() function. This function queries the server to return the employee's ID and Notes. Pass the returned array to the OnGetRowValues() function that specifies values for corresponding HTML elements.

The image below shows the result:

exSimpleSelection

//function is called on changing focused row
function OnGridFocusedRowChanged() {
    // Query the server for the "EmployeeID" and "Notes" fields from the focused row 
    // The values will be returned to the OnGetRowValues() function     
    grid.GetRowValues(grid.GetFocusedRowIndex(), 'EmployeeID;Notes', OnGetRowValues);
}
//Value array contains "EmployeeID" and "Notes" field values returned from the server 
function OnGetRowValues(values) {
    var notes = document.getElementById("detailnotes");
    notes.value = values[1];
    var image = document.getElementById("detailimage");
    image.src = "FocusedRow.aspx?Photo=" + values[0];
}
See Also