Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/259.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# XML DataGridView目录单元_C#_Datagridview_Xmldataset - Fatal编程技术网

C# XML DataGridView目录单元

C# XML DataGridView目录单元,c#,datagridview,xmldataset,C#,Datagridview,Xmldataset,我目前有一个DataGridView,它绑定到从XML文件读取的数据集 填充DataGridView很好;最后一列是我希望用户单击以提交对行的更改的按钮 我可以很容易地找到哪些行是脏的,但是,我很难找到脏行中哪些单元格本身是脏的 我遍历了脏行中的每个单元格,但它们没有显示为脏行 任何想法都很感激 if ( this.inventoryGridView.Columns[e.ColumnIndex].Name == "itemCheckedIn" ) { //

我目前有一个DataGridView,它绑定到从XML文件读取的数据集

填充DataGridView很好;最后一列是我希望用户单击以提交对行的更改的按钮

我可以很容易地找到哪些行是脏的,但是,我很难找到脏行中哪些单元格本身是脏的

我遍历了脏行中的每个单元格,但它们没有显示为脏行

任何想法都很感激

if ( this.inventoryGridView.Columns[e.ColumnIndex].Name == "itemCheckedIn" )
        {
            // Give the user a visual indicator the cells are "locked"/readonly by changing the background color
            this.inventoryGridView.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.LightGray;

            // Check if any changes have been made to the row that was checked in
            if ( this.inventoryGridView.IsCurrentRowDirty )
            {
                foreach ( DataGridViewCell dirtyBoy in this.inventoryGridView.CurrentRow.Cells )
                {
                    // Is he dirty?
                }
            }

            // No changes were made to the row that was check in; let's log the check in
            else
            {
                // Log the check in time
            }
您可以尝试以下方法:

将隐藏列添加到gridView 将任何值更改为行中的单元格时,绑定到javascript函数 更改值时,将单元格编号作为逗号分隔的值写入隐藏列,例如:1、3、5个单元格编号已更改 然后,您可以使用隐藏列值创建数组,并确切地知道行中更改了哪些单元格。
感谢Divi,这将是我最后的选择,然而,我想先检查一下,看看是否有一种合适的方法来获取脏电池。环岛总是让我感到寒冷>。我想不出任何其他方法来做这件事。我知道这是一个黑客行为,但……我不知道你是否可以在你的更改中添加一个脏类,看看这是否有帮助。