Hierarchical Modules
I have created a Hierarchical module structure for a quiz application.
The highest level is Lecture. Lecture has a child module named Questions. Questions has a child module called PossibleAnswers.
I created a lecture, 4 questions for the lecture and a few possible answers for each question.
When I retrieve the lectures there are 2 lectures returned, 1 that is status of master and visible = False, the other is status of Live and visible = True.
If I then get all of the questions there are 2 entries for each question 1 that is live and visibile and another that is master and not visible.
The issue is that the System Parent ID for all of the questions returned is the same as the id for the status = master lecture record. Did I do something wrong when entering my data for the modules? I would have assumed that the System Parent ID for the Live questions would be the same as the ID for the Live lecture and the System Parent ID for the master questions would match the ID for the Master lecture.
This same pattern exists between the questions and possible answers.
If this is normal then how do I retrieve the live questions for the Live lecture?
I have attached a jpg image of a screen shot with sample data for review.
Use something like this to access the child hierarchical items/
DynamicModuleManager dmm = DynamicModuleManager.GetManager();
var item = dmm.GetDataItems(
"DynamicModuleType"
).FirstOrDefault();
dmm.LoadChildItemsHierarchy(item);
var questions = item.SystemChildItems .Where(i =>i.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live && i.Visible);
foreach
(var q
in
questions)
dmm.LoadChildItemsHierarchy(q);
var answers = q.SystemChildItems.Where(i =>i.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live && i.Visible);
foreach
(var a
in
answers)
var ans = a.GetValue(
"nameOfField"
);
Thanks for the fast reply. I will give it a try!
Dont forget too that the DynamicModule builder also creates widgets for the front end too.