设置层次结构数据的最佳实践
我正在尝试找出设置层次结构数据的最佳实践,这些数据是从数据库中获取到某个可以显示层次结构的控制器中的。 基本上,这看起来像一个普通的树,但是当您按“章节”下的项目时,您会得到另一个页面的链接。
我有这些表格,这就是它们的连接方式,
Period
Courses
Subjects
Chapters
我从 DropDownBox 中选择“时间段”,然后我希望该时间段内的所有课程都排列起来。 每门课程下面都有一个主题,下面是章节,典型的层次结构。
这些表格通过线性方式相互引用而链接在一起。
我尝试使用树视图来显示这一点,但不明白该怎么做。 我虽然可以使用
标签并在运行时执行此操作。 Reapeter 或 datalist,可能吗?使用 XAML 中的数据绑定还是代码中的数据绑定更好?
I'm trying to figure out the best practice to setup hierarchy data that i take from a database into some contoller that would show the hierachy.
Basicly this would look like a normal tree but when you press the items that are under "chapters" you get a link to another page.
I have these tables and this is the way they are connected
Period
Courses
Subjects
Chapters
I select Period from a DropDownBox and then i want all the courses in that period to line up.
Under each course would be the subject and under them are the chapers, typical hierarchy.
The tables are linked together with refrences to each other in linear way.
I have tried to use treeview to show this, but dont understand how to do it.
I though i could use <ul><il>
tags and do it at runtime.
Reapeter or datalist, possible ?
Is it better to do this with databinding in XAML or in code ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据我的经验,最好用 li 和 ul 来实现。您可以更好地控制所有内容的显示方式。我得到的查询为我提供了所有记录、父项和深度。然后我循环遍历这些数据并生成列表标签。
In my experience its best to to it with li and ul. You have more control of how everything is displayed. I got the query that gives me all the records and parent and depth. Then I loop throught this data and generated the list tags.