我已经在 asp.net 中编写了用于简单中继器控制的代码,中继器正确绑定了数据,但渲染缺少一些数据!
有我的代码:
<asp:Repeater ID="dayRepeater" runat="server" >
<HeaderTemplate>
<table id="tes-table" width="100%" border="0"
cellspacing="0" cellpadding="0">
<tr >
<th >Column1</th>
<th >Column2</th>
<th >Column3</th>
<th >OFF_PEAK</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr >
<td><%# Eval("DayName") %></td>
</tr>
</ItemTemplate>
<AlternatingItemTemplate>
</AlternatingItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
**这是 Page_Load 中的隐藏代码:
private readonly string[] _daysText = {
DaysOfWeek.SATURDAY.ToString(),
DaysOfWeek.SUNDAY.ToString(),
DaysOfWeek.MONDAY.ToString(),
DaysOfWeek.TUESDAY.ToString(),
DaysOfWeek.WEDNESDAY.ToString(),
DaysOfWeek.THURSDAY.ToString(),
DaysOfWeek.FRIDAY.ToString(),
};
for (int j = 0; j < _daysText.Length; j++)
{
repeaterModel.Add(new TesRepeaterDataSource
{
DayName = _daysText[j],
});
}
dayRepeater.DataSource =repeaterModel;
dayRepeater.DataBind();
**数据绑定正确:
绑定
最后的观点
注意:我尝试绑定数据,page_init
但同样浏览器不显示任何数据,因此它不会从 css 中隐藏
慕娘9325324
相关分类