如何获取中继器控件中的 asp 控件 (_lblCouncils ) 的客户端 ID?
<ItemTemplate>
<div id="NotificationDiv">
<asp:Label ID="_lblRoleType" Text='<%#Eval("RoleType")%>' runat="server"></asp:Label>
<asp:Label ID="_lblCouncils" Text='<%#Eval("CouncilData")%>' runat="server" onclick="Name(this)"></asp:Label>
</div>
</ItemTemplate>
最佳答案
您必须处理OnRowDataBound(如果容器控件是GridView)或ItemDataBound事件(如果容器控件是Repeater),然后找到控件:
C#:
Labeb lbl = (Label)e.Item.FindControl("_lblRoleType");
VB:
Dim lbl as Label = CType(e.Item.FindControl("_lblRoleType"),Label)
关于javascript - 如何在转发器控件中获取asp控件(_lblCouncils)的客户端ID?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22483911/