我目前正在尝试使用 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 的一部分?