简体   繁体   中英

how to get client id of asp control (_lblCouncils ) in side a repeater control?

how to get client id of the asp control (_lblCouncils ) in side a repeater control?

<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>

You have to handle the OnRowDataBound(if the container control is a GridView), or ItemDataBound event(if the container control is a Repeater), then find the control:

C#:

Labeb lbl = (Label)e.Item.FindControl("_lblRoleType");

VB:

Dim lbl as Label = CType(e.Item.FindControl("_lblRoleType"),Label)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM