| Author |
Navigation channelandpostingcollection
|
|
| darryl.clark@gmail.com 2005-11-14, 7:48 am |
| I would like to build a sitemap from my channel and posting list.
However I have been playing around with channelandpostingcollection but
this seems to render the items in a non-hierarchial fashion as in the
following:
/Learning/environment/
/Learning/test/
/Learning/environment/nap/
/Learning/environment/rumble/
/Learning/environment/squish/
/Learning/environment/nap/default.htm
/Learning/environment/nap/nap.htm
/Learning/environment/nap/napSub/
/Learning/environment/rumble/rumble.htm
/Learning/environment/squish/squish.htm
/Learning/environment/squish/test.htm
The above uses the following code:
Dim chapost As ChannelAndPostingCollection =
chnStartChannel.AllChildren
chapost.SortByDisplayName()
Dim chnitem As ChannelItem
For Each chnitem In chapost
If chnitem.GetType.ToString =
"Microsoft.ContentManagement.Publishing.Channel" Then
Label1.Text &= chnitem.GetType.ToString & " " &
chnitem.Url & chnitem.SortOrdinal & " CH<br>"
Else
Label1.Text &= chnitem.GetType.ToString & " " &
chnitem.Url & chnitem.SortOrdinal & " PO<br>"
End If
Next
Whereas what I really want is
/Learning/environment/
/Learning/test/
/Learning/environment/nap/
/Learning/environment/nap/default.htm
/Learning/environment/nap/nap.htm
/Learning/environment/nap/napSub/
/Learning/environment/nap/napSub/test.htm
/Learning/environment/rumble/
/Learning/environment/rumble/rumble.htm
/Learning/environment/squish/
/Learning/environment/squish/squish.htm
/Learning/environment/squish/test.htm
So I really want to display a tree view type list really.
Any ideas folks. All help appreciated. As you can see unfashionably I
write in vb so translations from the popular C# would be much
appreciated.
Cheers
Clarkey
| |
| Stefan [MSFT] 2005-11-14, 5:54 pm |
| Hi Darryl,
actually I would expect that AllChildren only contains the list of all
direct elements.
So from the list below only
> /Learning/environment/
> /Learning/test/
Do you have a recursion or iteration to get to the child elements of these
two channels?
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no rights
New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
Check out the new book as well: Advanced MCMS development:
http://tinyurl.com/8ugwj
----------------------
<darryl.clark@gmail.com> wrote in message
news:1131975467.621708.282760@o13g2000cwo.googlegroups.com...
>I would like to build a sitemap from my channel and posting list.
> However I have been playing around with channelandpostingcollection but
> this seems to render the items in a non-hierarchial fashion as in the
> following:
>
> /Learning/environment/
> /Learning/test/
> /Learning/environment/nap/
> /Learning/environment/rumble/
> /Learning/environment/squish/
> /Learning/environment/nap/default.htm
> /Learning/environment/nap/nap.htm
> /Learning/environment/nap/napSub/
> /Learning/environment/rumble/rumble.htm
> /Learning/environment/squish/squish.htm
> /Learning/environment/squish/test.htm
>
> The above uses the following code:
>
> Dim chapost As ChannelAndPostingCollection =
> chnStartChannel.AllChildren
> chapost.SortByDisplayName()
> Dim chnitem As ChannelItem
> For Each chnitem In chapost
> If chnitem.GetType.ToString =
> "Microsoft.ContentManagement.Publishing.Channel" Then
> Label1.Text &= chnitem.GetType.ToString & " " &
> chnitem.Url & chnitem.SortOrdinal & " CH<br>"
> Else
> Label1.Text &= chnitem.GetType.ToString & " " &
> chnitem.Url & chnitem.SortOrdinal & " PO<br>"
> End If
>
> Next
>
> Whereas what I really want is
>
> /Learning/environment/
> /Learning/test/
> /Learning/environment/nap/
> /Learning/environment/nap/default.htm
> /Learning/environment/nap/nap.htm
> /Learning/environment/nap/napSub/
> /Learning/environment/nap/napSub/test.htm
> /Learning/environment/rumble/
> /Learning/environment/rumble/rumble.htm
> /Learning/environment/squish/
> /Learning/environment/squish/squish.htm
> /Learning/environment/squish/test.htm
>
> So I really want to display a tree view type list really.
>
> Any ideas folks. All help appreciated. As you can see unfashionably I
> write in vb so translations from the popular C# would be much
> appreciated.
>
> Cheers
>
> Clarkey
>
| |
| Sathish Kumar K 2005-11-14, 5:54 pm |
| Hello Clarkey,
You can try the sitemap sample available on the GOTDOTNET. It would help
you have more idea.
http://www.codeproject.com/aspnet/cmssitemap.asp
Regards,
Sathish Kumar K
> I would like to build a sitemap from my channel and posting list.
> However I have been playing around with channelandpostingcollection
> but this seems to render the items in a non-hierarchial fashion as in
> the following:
>
> /Learning/environment/
> /Learning/test/
> /Learning/environment/nap/
> /Learning/environment/rumble/
> /Learning/environment/squish/
> /Learning/environment/nap/default.htm
> /Learning/environment/nap/nap.htm
> /Learning/environment/nap/napSub/
> /Learning/environment/rumble/rumble.htm
> /Learning/environment/squish/squish.htm
> /Learning/environment/squish/test.htm
> The above uses the following code:
>
> Dim chapost As ChannelAndPostingCollection =
> chnStartChannel.AllChildren
> chapost.SortByDisplayName()
> Dim chnitem As ChannelItem
> For Each chnitem In chapost
> If chnitem.GetType.ToString =
> "Microsoft.ContentManagement.Publishing.Channel" Then
> Label1.Text &= chnitem.GetType.ToString & " " &
> chnitem.Url & chnitem.SortOrdinal & " CH<br>"
> Else
> Label1.Text &= chnitem.GetType.ToString & " " &
> chnitem.Url & chnitem.SortOrdinal & " PO<br>"
> End If
> Next
>
> Whereas what I really want is
>
> /Learning/environment/
> /Learning/test/
> /Learning/environment/nap/
> /Learning/environment/nap/default.htm
> /Learning/environment/nap/nap.htm
> /Learning/environment/nap/napSub/
> /Learning/environment/nap/napSub/test.htm
> /Learning/environment/rumble/
> /Learning/environment/rumble/rumble.htm
> /Learning/environment/squish/
> /Learning/environment/squish/squish.htm
> /Learning/environment/squish/test.htm
> So I really want to display a tree view type list really.
>
> Any ideas folks. All help appreciated. As you can see unfashionably I
> write in vb so translations from the popular C# would be much
> appreciated.
>
> Cheers
>
> Clarkey
>
| |
| darryl.clark@gmail.com 2005-11-14, 5:54 pm |
| Stefan,
Thanks for your prompt reply.
Sorry, I had the code inside another sub that was being looped. I have
taken it out and put it in it's own sub and everything works fine now.
Cheers
Darryl
|
|
|
|