This example demonstrates how to use the server-side GetSelectedFieldValues method to obtain field values of multiple selected rows.
Follow the steps below:
-
Set the grid's AllowSelectByRowClick property to
trueto enable row selection.protected void Page_Init(object sender, EventArgs e) { // ... ASPxGridView1.SettingsBehavior.AllowSelectByRowClick = true; // ... }
-
In a button's
Clickevent handler, call theGetSelectedValuesfunction. In this function, get the field names of grid columns and call the GetSelectedFieldValues method to obtain the field values of selected rows.protected void ASPxButton1_Click(object sender, EventArgs e) { GetSelectedValues(); // ... } List<object> selectedValues; private void GetSelectedValues() { List<string> fieldNames = new List<string>(); foreach(GridViewColumn column in ASPxGridView1.Columns) if(column is GridViewDataColumn) fieldNames.Add(((GridViewDataColumn)column).FieldName); selectedValues = ASPxGridView1.GetSelectedFieldValues(fieldNames.ToArray()); }
- Default.aspx (VB: Default.aspx)
- Default.aspx.cs (VB: Default.aspx.vb)
(you will be redirected to DevExpress.com to submit your response)
