当前位置: 代码迷 >> ASP.NET >> 怎么获得repeater页眉模板中绑定的控件(online.)
  详细解决方案

怎么获得repeater页眉模板中绑定的控件(online.)

热度:7989   发布时间:2013-02-26 00:00:00.0
如何获得repeater页眉模板中绑定的控件(online...)
<asp:repeater   id= "rePets "   runat= "server ">
<HeaderTemplate>
<table> <tr> <td>
<asp:CheckBox   ID= "chkPets "   Runat= "server "   Text= "pets "> </asp:CheckBox>
</td> </tr>
</HeaderTemplate>
<ItemTemplate>
<tr> <td> <asp:CheckBox   ID= "chkPet "   Runat= "server "   Text= ' <%#   DataBinder.Eval(Container.DataItem, "smallName ")%> '> </asp:CheckBox>
</td> </tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:repeater>
==================================================
如何获得chkPets呀??

------解决方案--------------------------------------------------------
你是想用js获得吗?

------解决方案--------------------------------------------------------
foreach (RepeaterItem ri in rePets.Items)
{
if (ri.ItemType == ListItemType.Header)
{
System.Web.UI.WebControls.CheckBox cb = ri.FindControl( "chkPets ");
}
}
  相关解决方案