获取Repeater中Footer/HeaderTemplate 中的控件

通常我们可以在ItemCreated或者ItemDataBound事件中获取模板列中的控件,那如何在非列表控件本身事件外获取呢?
Repeater:
            foreach (RepeaterItem item in rptEnquiries.Controls)
            
{
                
if (item.ItemType == ListItemType.Footer)
                
{
                    item.FindControl(
"btnSend1").Visible = true;
                    
break;
                }
              
            }
 


DataList:

DataGrid:

试了好半天才试出来

由于要做排序的需要这个

原文地址:https://www.cnblogs.com/goody9807/p/1257457.html