Skip to content

DevExpress-Examples/asp-net-web-forms-grid-get-column-values-of-multiple-selected-rows

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Grid View for ASP.NET Web Forms - How to get column values of multiple selected rows.

This example demonstrates how to use the server-side GetSelectedFieldValues method to obtain field values of multiple selected rows.

GetSelectedFieldValues

Overview

Follow the steps below:

  1. Set the grid's AllowSelectByRowClick property to true to enable row selection.

    protected void Page_Init(object sender, EventArgs e) {
        // ...
        ASPxGridView1.SettingsBehavior.AllowSelectByRowClick = true;
        // ...
    }
  2. In a button's Click event handler, call the GetSelectedValues function. 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());
    }

Files to Review

Documentation

About

Use the server-side GetSelectedFieldValues method to obtain field values of multiple selected rows.

Topics

Resources

License

Stars

Watchers

Forks