如何用DataRow做数据源

方法一:

DataTable dt = ...;
DataView dv = dt.DefaultView;
dv.RowFilter = string.Format("TaskGroup='{0}'", ...);

rbl.DataSource = dv;
rbl.DataTextField = "Info";
rbl.DataValueField = "TaskID";
rbl.DataBind();

方法二:

DataTable newTable = yourDataRow.Table.Copy();
newTable.Rows.Clear();
newTable.ImportRow(yourDataRow);
newTable.AcceptChanges();

然后用这个 newTable 去做数据源

你可能感兴趣的:(Data)