Get Control from FooterTemplate of Repeater
<FooterTemplate>
<tr>
<td class="menu">
<a href="/Contact.aspx">Pomoč in podpora</a>
</td>
</tr>
<tr>
<td>
<asp:DropDownList ID="ddl开发者_C百科ChangeUser" runat="server" CssClass="childrenSelectType" AutoPostBack="True" Visible="false" OnSelectedIndexChanged="ddlChangeUser_SelectedIndexChanged">
</asp:DropDownList>
</td>
</tr>
How can i get ddlChangeUser control from FooterTemplate of repeater.
This is not ok, becouse it is not in ItmeTemplate.
DropDownList ddlChangeUser = siteMapAsBulletedList.Items[0].FindControl("ddlChangeUser") as DropDownList;
You need to use the ItemDataBound event and in there check for Footer.
siteMapAsBulletedList.ItemDataBound += new RepeaterItemEventHandler(siteMapAsBulletedList_ItemDataBound);
...
void siteMapAsBulletedList_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Footer)
{
DropDownList ddlChangeUser = (DropDownList)e.Item.FindControl("ddlChangeUser");
if (ddlChangeUser != null) {
...
}
}
}
精彩评论