有没有办法在DataRowView
中获取所选DataRow
的索引?
我目前有以下代码
private long GetSelectedIndex(DataView dataView, string searchString)
{
long selectedIndex = 0;
foreach(DataRowView dataRow in dataView)
{
if(dataRow.Row.ItemArray.Contains(searchString)
{
//Do Something.... I've tried everything to get the index out of the dataRow
}
}
return selectedIndex;
}
最佳答案
也许尝试
int index = dataView.Table.Rows.IndexOf(dataRow.Row)
关于c# - 在DataView中查找DataRowView的索引,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/49619264/