ChannelCollection Repeater.Databind
Windows Server Forum Index Windows Server
Server discussion on Windows platform.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web winserverhelp.com
ChannelCollection Repeater.Databind

 
Post new topic   Reply to topic    Windows Server Forum Index -> CMS Server
Author Message
Lta
Guest





Posted: Tue Oct 25, 2005 8:51 pm    Post subject: ChannelCollection Repeater.Databind Reply with quote

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
Back to top
Mei Ying [MVP]
Guest





Posted: Wed Oct 26, 2005 8:51 am    Post subject: RE: ChannelCollection Repeater.Databind Reply with quote

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:

Quote:
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
Back to top
 
Post new topic   Reply to topic    Windows Server Forum Index -> CMS Server All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




New Topics Powered by phpBB