I have the following set up in my CMS
Under ContactUsPageSettings I have some items that are using a template called ContactUsQuestionsOption and then below that I have some items that are using a template called ContactUsSubQuestionOption.
I want to return all of the ContactUsQuestionsOption in a drop down list, which I have managed to do. The problem I'm having is having a second drop down list that only returns the children of the selected item. Looking at the image above if Faculty Research and Publications was selected I'd want the second drop down to show BSR, Faculty Enquiries and ResearchSupportEnquiries.
I have a view model that looks like this:
[SitecoreType(AutoMap = true)]
public class ContactUsPageSettingsViewModel : ContactUsPageSettings
{
[SitecoreQuery(".//*[@@templatekey='contactusquestionsoption']", IsLazy = false, IsRelative = true)]
public IEnumerable<ContactUsQuestionsOption> QuestionsOptionItems { get; set; }
[SitecoreQuery("./child::*", IsLazy = true, IsRelative = true)]
public virtual IEnumerable<ContactUsPageSettingsViewModel> Children { get; set; }
}
And a second view model like this:
[SitecoreType(AutoMap = true)] public class QuestionsViewModel : ContactUsQuestionsOption { [SitecoreQuery(".//*[@@templatekey='contactussubquestionsoption']", IsLazy = false, IsRelative = true)] public virtual IEnumerable QuestionsOptionItems { get; set; }
}
But this doesn't appear to be the answer. Any ideas?