DataTable dt = new DataTable();
DataColumn dc = new DataColumn("列1", typeof(System.String));
dt.Columns.Add(dc);
dc = new DataColumn("列2", typeof(System.String));
dt.Columns.Add(dc);
dc = new DataColumn("列3", typeof(System.String));
dt.Columns.Add(dc);
foreach (GridViewRow currow in GridView1.Rows )
{
CheckBox cb = currow.FindControl("CheckBox1") as CheckBox;
if (cb.Checked)
{
DataRow dr = dt.NewRow();
dr["列1"] = currow.Cells[0].Text;
dr["列2"] = currow.Cells[1].Text;
dr["列3"] = currow.Cells[2].Text;
dt.Rows.Add(dr);
}
}

相关文章:

  • 2022-12-23
  • 2021-12-11
  • 2021-08-23
  • 2022-12-23
  • 2021-10-27
  • 2022-12-23
  • 2022-01-30
  • 2022-12-23
猜你喜欢
  • 2021-06-06
  • 2022-12-23
  • 2022-01-29
  • 2022-12-23
  • 2022-12-23
  • 2021-09-23
  • 2022-12-23
相关资源
相似解决方案