我使用本教程使用中继器在我的项目页面上显示名称列表。
所以我正在使用动态数据,在我的 aspx.cs 页面中我有:
List<string> subContractors = new List<string>();
Context db = new Context();
subContractors = (from SUBContractors in db.BOQ_SubContractors
where SUBContractors.Bill_Of_Quantity_id == this.boqId
select SUBContractors.Sub_Contractor.Company_Name).ToList();
repeaterShowSubContractorName.DataSource = subContractors; repeaterShowSubContractorName.DataBind();
在我的 aspx 中:
<asp:Repeater ID="repeaterShowSubContractorName" runat="server" OnItemDataBound="subContractors_ItemDataBound">
<HeaderTemplate>
<table>
<tr>
<th>
<asp:Label ID="SubConName" Text="SubContractor Name" runat="server"></asp:Label>
</th>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<asp:Label ID="SubCon" Text='<%# Eval("subContractors") %>' runat="server"></asp:Label>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
错误来自OnItemDataBound="subContractors_ItemDataBound"
.
我将其链接到什么或在哪里?我目前没有subContractors_ItemDataBound
。