【发布时间】:2025-12-29 00:10:11
【问题描述】:
我想给 asp.net 转发器页脚模板中的控件赋值。
Dim FooterTemplate As Control = TicketRepeater.Controls(TicketRepeater.Controls.Count - 1).Controls(0)
Dim lblFooter As Literal = TryCast(FooterTemplate.FindControl("TicketTotalNumberOfTickets"), Literal)
lblFooter.Text = TicketDataTable.Rows.Count.ToString()
返回错误:
Specified argument was out of the range of valid values.
Parameter name: index
AFAIU it cant find count of controls = no controls found?。有什么建议吗?
检查点:
- 所有的 ID 都是正确的
- repeater 有 3 部分 headertemplate, 项目模板、页脚模板
救命!
更新
代码在databind() 之后实际工作。任何想法如何在数据绑定事件之前使其工作?
【问题讨论】:
标签: asp.net vb.net repeater asprepeater