|
Home > Archive > Microsoft Content Management Server > October 2005 > ChannelCollection Repeater.Databind
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
ChannelCollection Repeater.Databind
|
|
|
| Hi,
I am trying to databind a ChannelCollection to a repeater control but I
think I am expecting it to be far to easy.
Channel collection:
public static ChannelCollection GetSubChannels(Channel c)
{
ChannelCollection cc = null;
if (c != null)
{
cc = c.Channels;
}
return cc;
}
Repeater Html:
<asp:repeater id="SectionMenu" runat="server">
<HeaderTemplate>
head HTML
</HeaderTemplate>
<ItemTemplate>
<Li>
<%# DataBinder.Eval(Container.DataItem, "DisplayName") %>
</Li>
</ItemTemplate>
<FooterTemplate>
foot HTML
</FooterTemplate>
</asp:repeater>
DataBind:
Guid g = GetRootNavGuid(thisUrl);
Channel c = Functions.Channels.GetChannelByGuid(g);
ChannelCollection sc = Functions.Channels.GetSubChannels(c);
sectionMenu.DataSource = sc;
sectionMenu.DataBind();
Any suggestions?
Thanks
| |
| Mei Ying [MVP] 2005-10-26, 2:48 am |
| Hi
The code looks good :-)
There could be a tiny typo with "sectionMenu". It's defined to have a
capital "S" in the HTML.
--
regards
Mei Ying
---
Blog: http://meiyinglim.blogspot.com
Book: http://www.packtpub.com/book/mcms
Contact: meiyinglim@hotmail.com
---
"Lta" wrote:
> Hi,
>
> I am trying to databind a ChannelCollection to a repeater control but I
> think I am expecting it to be far to easy.
>
> Channel collection:
>
> public static ChannelCollection GetSubChannels(Channel c)
> {
> ChannelCollection cc = null;
> if (c != null)
> {
> cc = c.Channels;
> }
> return cc;
> }
>
> Repeater Html:
>
> <asp:repeater id="SectionMenu" runat="server">
> <HeaderTemplate>
> head HTML
> </HeaderTemplate>
> <ItemTemplate>
> <Li>
> <%# DataBinder.Eval(Container.DataItem, "DisplayName") %>
> </Li>
> </ItemTemplate>
> <FooterTemplate>
> foot HTML
> </FooterTemplate>
> </asp:repeater>
>
>
> DataBind:
>
> Guid g = GetRootNavGuid(thisUrl);
> Channel c = Functions.Channels.GetChannelByGuid(g);
> ChannelCollection sc = Functions.Channels.GetSubChannels(c);
> sectionMenu.DataSource = sc;
> sectionMenu.DataBind();
>
> Any suggestions?
>
> Thanks
|
|
|
|
|