开发者

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) {
                   ...
        }
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜