【发布时间】:2011-08-28 03:19:13
【问题描述】:
我目前正在尝试使用 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 的一部分?
【问题讨论】:
-
BL.GetDataTable() 中的 BL 是什么; ??
-
BL可能是指他的“业务逻辑”?
标签: c# datatable datarepeater powerpacks