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();
Hi,
the correct lookup of the template is:
this.NewsExplorer.Groups[0].Items[0].FindControl("HeadlineFader");
What's in the code of the sample will obviously not work, since it's trying to obtain an instance of the ListView, from the template definition object, not from a specific instantiation of it, for some WebExplorerBar item.
Thanks,
Lubomir
Please let me know how to find the controls inside WebExplorerBar in javascript. I am able to get in code behind, please guide me in javascript as well.