Microsoft Content Management Server - MCMS 2002 - Sort Placeholder Content in ArrayList

This is Interesting: Free IT Magazines  
Home > Archive > Microsoft Content Management Server > July 2005 > MCMS 2002 - Sort Placeholder Content in ArrayList





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 MCMS 2002 - Sort Placeholder Content in ArrayList
jarkkotv

2005-07-28, 7:49 am

Hi!

I have a little problem with the MCMS 2002 and I would appreciate if
someone could help me with this one

I loop through PostingCollection normally. I add each Posting's
Title-HtmlPlaceholder's text into the ArrayList (Placeholder can
contain also Scandic letters). After the loop I try to sort this
Arraylist alphabetically by using the Sort-method, but the ArrayList is
not sorted correctly.

For example: If Title-placeholders contain following letters A,B,C...=C5
Result will look like the following: A,=C5,B,C...

Does anyone know, what might be the solution for this one?

Thanks a lot!

Jarkko


..=2E.first we do something

ArrayList arrList =3D new ArrayList();
PostingCollection pCol =3D CmsHttpContext.Current.Channel.Postings;
foreach (Posting pPosting in pCol)
{
PlaceholderCollection phCol =3D pPosting.Placeholders;
foreach (Placeholder ph in phCol)
{
if (ph.Name.Equals("Title"))
{
HtmlPlaceholder h =3D pPosting.Placeholders["Title"] as
HtmlPlaceholder;
arrList.Add(h.Text);
}
}
}
arrList.Sort();

for(int i=3D0; i<arrList.Count; i++)
{
Response.Write(arrList[i]);
}

Stefan [MSFT]

2005-07-28, 7:49 am

Hi Jarko,

what's wrong with the sort order below?
Sort functions usually take care of your system local. Depending to the
system local different sort orders will be returned.

Btw: this is not a MCMS question. Questions about sorting an Arraylist
should better be placed on an ASP.NET related newsgroup.

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
----------------------


"jarkkotv" <jarkkotv@hotmail.com> wrote in message
news:1122543532.598341.130030@o13g2000cwo.googlegroups.com...
Hi!

I have a little problem with the MCMS 2002 and I would appreciate if
someone could help me with this one

I loop through PostingCollection normally. I add each Posting's
Title-HtmlPlaceholder's text into the ArrayList (Placeholder can
contain also Scandic letters). After the loop I try to sort this
Arraylist alphabetically by using the Sort-method, but the ArrayList is
not sorted correctly.

For example: If Title-placeholders contain following letters A,B,C...Å
Result will look like the following: A,Å,B,C...

Does anyone know, what might be the solution for this one?

Thanks a lot!

Jarkko


....first we do something

ArrayList arrList = new ArrayList();
PostingCollection pCol = CmsHttpContext.Current.Channel.Postings;
foreach (Posting pPosting in pCol)
{
PlaceholderCollection phCol = pPosting.Placeholders;
foreach (Placeholder ph in phCol)
{
if (ph.Name.Equals("Title"))
{
HtmlPlaceholder h = pPosting.Placeholders["Title"] as
HtmlPlaceholder;
arrList.Add(h.Text);
}
}
}
arrList.Sort();

for(int i=0; i<arrList.Count; i++)
{
Response.Write(arrList[i]);
}


jarkkotv

2005-07-28, 7:49 am

Thanks Stefan!

Yes, I know that this not the actual MCMS-problem, but I was just
wondering if someone working with the MCMS have had the same kind of
problems

I'll try some one other ASP.NET newsgroup.

Jarkko

PS: Thanks for the many useful tips you have given to us MCMS-people

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com