在cs后台获取前台datalist控件里的其他控件

前台:

<asp:DataList ID="datalist1" runat="server"  HorizontalAlign="Center">
               <ItemTemplate>
                           <asp:HyperLin ID="HyperLink1" class="button" NavigateUrl='<%#Eval("id","Detail.aspx?id={0}") %>'   Visible="false" runat="server">阅读更多</asp:HyperLink>                       
               </ItemTemplate>          
</asp:DataList>

后台:

for (int i = 0; i < this.datalist1.Items.Count; i++)

{

        HyperLink lbtn = (HyperLink)this.datalist1.Items[i].FindControl("HyperLink1");
        lbtn.Visible = true;
}

你可能感兴趣的:(在cs后台获取前台datalist控件里的其他控件)