如何在运行时将DataTable绑定到DataRepeater(Windows Powerpack)?

| 我目前正在尝试使用Windows Powerpack DataRepeater控件显示DataTable中的数据。 到目前为止,DataRepeater识别出从数据库调用的结果DataTable有8行,但是我还无法获得3个文本框(我已将其放入DataRepeater的ItemTemplate中)以显示实际数据在所述行中。
DataTable DT = BL.GetDataTable();
BindingSource bSource = new BindingSource();
bSource.DataSource = DT;
DR.DataSource = bSource;

txtEmail.DataBindings.Add(\"Text\", bSource, \"Email\");
txtID.DataBindings.Add(\"Text\", bSource, \"ID\");
txtName.DataBindings.Add(\"Text\", bSource, \"Name\");
因此,一旦查看了DataRepeater(DR),您将看到8行。如果将文本框保留为DR的一部分,则它们将在这8行中的每行上重复,但没有数据。 如果删除文本框并将其直接放置在表单上,​​那么在DR导航中,文本框将显示相应的数据。这不是我要寻找的行为。 有谁知道如何让文本框显示数据并成为DataRepeater的一部分?     
已邀请:
我知道已经晚了,但是如果您还没有找到答案,我会贴这个贴子,以防万一。 我遇到了同样的问题,首先将元素绑定到数据,然后才绑定数据重发器。因此,您的代码应如下所示:
    txtEmail.DataBindings.Add(\"Text\", \"\", \"Email\");
    txtID.DataBindings.Add(\"Text\", \"\", \"ID\");
    txtName.DataBindings.Add(\"Text\", \"\", \"Name\");

    DataTable DT = BL.GetDataTable();
    bSource.DataSource = DT;
    DR.DataSource = bSource;
    

要回复问题请先登录注册