Manually creating ordered lists - need help

  • Thread starter Thread starter Ryan Ternier
  • Start date Start date
R

Ryan Ternier

I'm currently run into a snag on one of my projects. We need to create an
ordered list (Mutli levels).

Ie:


1. Some Title
....A....Something here
....B....Something Else
2. Another Title
....A.....I'm here Again
........a....And again.
.............1....One more indent
3..and another

(I don't know if what I typed up there will appear that way... it should)
without the dots.


I have 2 DataTables. One has all the Titles, and the titles that have the
indent. THen I have all the items that go under those titles the other
DataTable.

There are no Child-Parent relations, instead I've used an "Indent" column
(int) that tells me how many times to indent that title, then all items
under that Title will be moved over X amout of pixels.

THe other night I was thinking about using a Recursive loop for this, but
don't know where to start. I'm doing this in C#, and it is being rendered to
PDF so I have some control over how to put the lists.

I can't use HTML.

ANy help would be awesome!

thx.
 
Ryan - how do you know which song goes with the title? Is there a
prohibition for using a relationship for this would certainly make the
problem much easier. You could foreach the Titles, then use GetChildRows
for the songs and easily iterate through this.
 
The Titles Table has a HeaderID field. Each Item also has a HeaderID in it.

Currently I run through 2 for loops to get the current list (which prints
out perfectly, with indenting), I just need to stick the numbers/letters
(bullets) where they need to go.

The GetChildRows would do exactly what I'm doing now. I just don't know how
to do the logic of building the numbering... I have an Idea though:

Recursive Function BuildList(Previous.Indent, Previous.LetterNumberUsed,
bool StartAgain)
{
Do a check to see if this is the Base Number

......Is this row.indent > last row.indent?
.........BuildList(row.indent, row.letter, true)
.....Else
.........AddItem(ItemNameAndInformation, LetterToBeUsed)

}

I think a recursive function would be best, so I'll play around with it.

/RT
 
Back
Top