I have these tables Pages
, PageVersions
and ElementsOnPageVersions
.
I want to show this on a page all at once, in a collapsible kind of view.
Like this:
Page 1
Page 2
Page 3
Page 4
I'm uncertain on what the best way to retrieve the data and easily show it in the collapsaple layout is.
I would do something like this:
This would be the way I would do it, at this moment. But it seems too heavy, and a lot of iterating.
What would be the best way to do this?
A nested list is created by placing a comma-separated sequence of sublists.
A list that occurs as an element of another list (which may ofcourse itself be an element of another list etc) is known as nested list.
A nested list is a list of lists, or any list that has another list as an element (a sublist). They can be helpful if you want to create a matrix or need to store a sublist along with other data types.
By default, a list nested inside another list receives different bullets/numbers from the parent list. This is great for creating visual distinction between the different levels of hierarchy. To create custom nested list styles, you can use a decendant selector. ul ul selects for any list inside another list.
I'd think about projecting your three different items to a single self-referencing list. Each item would need an Id, Description, and ParentId. I'd make a view model for this purpose.
public class TreeItem {
public int Id {get; set;}
public string Description {get; set;}
public int ParentId {get; set;}
}
That would allow for you to leverage either an asp:TreeView in webforms or whatever flavor of jQuery tree / treeview if you're using MVC.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With