Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
435
Controls array is empty in template?
posted

I have a WebExplorerBar I am attempting to use as a replacement for WebPanel.  I'm adding a control template and trying to bind to a ul list.  I have javascript that will "scroll" through the UL showing one item at a time.  The problem is, when i try to access the ListView item in the template, FindControl is returning null.  If i look at the ControlCollection object in the template, (either via FindTemplateByID or Templates[0] of the explorer) it comes back with 0 items.  What am i doing wrong?

 

    <ig:WebExplorerBar runat="server" ID="NewsExplorer" Width="100%">

        <Groups>

            <ig:ExplorerBarGroup Text="News and Headlines">

                <Items>

                    <ig:ExplorerBarItem TemplateId="NewsItem">

                    </ig:ExplorerBarItem>

                </Items>

            </ig:ExplorerBarGroup>

        </Groups>

        <Templates>

            <ig:ItemTemplate TemplateID="NewsItem">

                <Template>

                    <asp:ListView ID="HeadlineFader" runat="server" EnableViewState="false">

                        <LayoutTemplate>

                            <ul id="newsfade">

                                <asp:PlaceHolder ID="itemPlaceholder" runat="server" />

                            </ul>

                        </LayoutTemplate>

                        <ItemTemplate>

                            <li class="newsitems">

                                <asp:HyperLink ID="NewsLink" runat="server" NavigateUrl="#" rel='<%# "#NEWS" + Eval("ID") %>' title='<%#Eval("TEXT") %>' Text='<%# Eval("TITLE")%>' />

                            </li>

                        </ItemTemplate>

                    </asp:ListView>

                </Template>

            </ig:ItemTemplate>

        </Templates>

    </ig:WebExplorerBar>

 

(CodeBehind)

        ItemTemplate temp = this.NewsExplorer.FindTemplateById("NewsItem");

        ListView HeadlineFader = temp.FindControl("HeadlineFader") as ListView;

        HeadlineFader.DataSource = NewsData.GetNews();

        HeadlineFader.DataBind();