我有一个单行数据网格视图。该行是从父 datagridview 填充的(我从中选择了单行)。该行具有标题(从父 datagridview 克隆)。
我知道主键列标题的名称。我如何获得主键列下的值?
在网上我发现了类似的东西
...(row.Cells["xxx"].Value, 123)
或者
string a = Convert.ToString(selectedRow.Cells["you have to mention you cell corresponding column name"].Value);
或者
string pk_col_val = Convert.ToString(grid_detail.CurrentRow.Cells[i].FormattedValue);
但没有一个显示如何得到我想要的。
我需要一种方法来按列的名称而不是 id.HOW 获取值?
帮助 ?