How to find controls in a repeater header or footer

前端 未结 8 2134
离开以前
离开以前 2020-11-28 02:19

I was wondering how one would find the controls in the HeaderTemplate or FooterTemplate of an Asp.Net Repeater control.

I can access them on the ItemDataBound event,

8条回答
  •  清歌不尽
    2020-11-28 03:05

    Better solution

    You can check item type in ItemCreated event:

    protected void rptSummary_ItemCreated(Object sender, RepeaterItemEventArgs e) {
        if (e.Item.ItemType == ListItemType.Footer) {
            e.Item.FindControl(ctrl);
        }
        if (e.Item.ItemType == ListItemType.Header) {
            e.Item.FindControl(ctrl);
        }
    }
    

提交回复
热议问题