如何在中继器中找到标头控制

How to find header Control In Repeater?

本文关键字:控制 中继器      更新时间:2023-09-26

我在C#中的中继器中找到标头控制

HtmlGenericControl nameposition = null;
                          nameposition = (HtmlGenericControl)Repeater1.Controls[0].Controls[0].FindControl("tweet-container");

我收到错误如何使用它?。Aspx代码

<div  id="tweet-container" runat="server"> </div>

因此,如果它是一个服务器控件,您可以简单地使用:
在Repeater_ItemDataBound事件中

   HtmlGenericControl divControl = e.Item.FindControl("tweet-container") as HtmlGenericControl;