ASP.NET DataList中 查找 <FooterTemplate>中的控件

///DataList中FooterTemplate中 控件 在代码中直接找不到的, 
 /// 查找 FooterTemplate 中 控件 CheckBox , 测试完全可以找到使用
 CheckBox cbOptionalBHI = (CheckBox)((DataListItem)ExactCareDataList.Controls[ExactCareDataList.Controls.Count - 1]).FindControl("cbOptionalBHI");


 查找 FooterTemplate中 的DIV , 这个div 要有runat="server"属性:

///divOptionalBHI 为要查找的div的 id 
var divOptionalBHI = (ExactCareDataList.Controls[ExactCareDataList.Controls.Count - 1]).FindControl("divOptionalBHI");
divOptionalBHI.Visible = true;

  

posted @ 2017-01-12 14:59  jason_LSZ  阅读(239)  评论(0编辑  收藏  举报