The comparison of cells in DataGrid [Sharing] The comparison of cells in DataGrid has been taken for nearly half an hour before testing. Think of the DataGrid's line in ASP.NET is also DataRow. Can't find it. Later, I saw a Tip of the DataGridItemCollection and the latter of the DataGridItem (row). So this sentence: int i = dgcourse.Items.count; // DGCourse returns the value of i for the specific line of the specific row Well, finally found it. But what should I do if the columns in the row do? Also think of Datacolumn has a DataGrid.columns in DataGrid but only for all columns, cannot perform a single row comparison. So in DataGrid.item, I found a DataGrid.Item.cells of Dongdong, prompt "DataGrid item" Well. It should be it, take two index and convert the string into int to compare See int coursePeo = 0; Foreach (DataGridItem di in dgcourse.Items) // DataGridItem represents rows in DataGrid {CourseCount = Int.Parse (Di.cells [5] .text); // DataGridItem.cells [5] Indicates the sixth cell courseo = int.parse (di.cells [6] .text); if (coursecount <= coursepeo) // cell is compared {di.cells [6]. Manufactolor = System.drawing.color.Red; // If it is not larger than the red}}}