var v1 = bindingSourceBase.DataSource as DataTable;
foreach (DataRowView v in v1.DefaultView)
{
v["isUnChecked"] = true;
//listTemp.Add(ConvertToModel<vwERP_PM_MtlOutDetail>(v.Row));
}
有时需要判断下这个datasource是什么类型的
if (bindingSourceBase.DataSource is DataSet)
{
ds = (DataSet)bindingSourceBase.DataSource;
}
else if (bindingSourceBase.DataSource is DataView)
{
ds = ((DataView)bindingSourceBase.DataSource).Table.DataSet;
}
else if (bindingSourceBase.DataSource is DataTable)
{
ds = ((DataTable)bindingSourceBase.DataSource).DataSet;
}