The values come from a database. I have to check every value of this column
Instead of trying to get all column values from the DataGrid
, access the DataTable
directly in your code. As you did not provide information on that, I assume that the column data type is string
and the column ID is ParaXML
. If it is different in your code, please adapt the following samples.
foreach(DataRow row in dt.Rows)
{
var columnValue = (string)row["ParaXML"];
// ...do something with the column value.
}
If you want to get all column values as a list instead, you can do it like above in a loop or using Linq.
var paraXmls = new List<string>();
foreach(DataRow row in dt.Rows)
paraXMLs.Add((string)row["ParaXML"]);
var paraXmls = dt.AsEnumerable().Select(row => row.Field<string>("ParaXML")).ToList();