The content you're reading is getting on in years
This post is on the older side and its content may be out of date.
Be sure to visit our blogs homepage for our latest news, updates and information.
Well, except from the fact that one of the pillars of good parenthood is the ability to tell your own children from all the other kids, there are actually other (more practical and less formal) reasons why you may need to get the reference to all the child pages of any given page made with Sitefinity.
Let’s imagine following scenario. You ran a website for a local car dealership. The dealership struck a deal with a monthly car fan magazine to be published online on their website. So, you go and create a page for the car magazine. This page then contains pages that each represent a monthly issue. Inside of these monthly issue pages, you then have pages like news, car tests, articles etc.
What you’d like to do is to show on the right side of the magazine front page description and link to all the cover stories from each issue.
Take a look at the screenshot to get an idea what am I talking about (click on the thumbnail to enlarge it).
First create the page structure like described in the scenario : Magazine > Issue #1 > News, Articles… Create two issue pages just to see the point of the example.
For each “magazine issue” page set the page title to the cover story title and in description type the brief introduction of the cover story. Take a look at the screenshot to get an idea (click on the thumbnail to enlarge it).
It is important to set these values to reflect the cover story of the issue, since we will use the CmsPage.Title and CmsPage.Description properties to create our User Control with the cover stories.
Create CoverStories.ascx User Control
Once, you are done with that we’ll create a User Control that will display all Cover stories on the right side of magazine front page. The approach we’ll take here is to get the current node of the sitemap (magazine front page) and then loop through all of it immediate children (issue pages), extract page title and page description and create controls with those value. Take a look at the code bellow :
Now, all that’s left is to upload the user control and add it to our magazine page. Consult the Developer Manual if you are unsure how to add User Control to Sitefinity page.
Hopefully, you’ll find some use of this
View all posts from The Progress Team on the Progress blog. Connect with us about all things application development and deployment, data integration and digital business.
Let our experts teach you how to use Sitefinity's best-in-class features to deliver compelling digital experiences.
Learn MoreSubscribe to get all the news, info and tutorials you need to build better business apps and sites
Progress collects the Personal Information set out in our Privacy Policy and the Supplemental Privacy notice for residents of California and other US States and uses it for the purposes stated in that policy.
You can also ask us not to share your Personal Information to third parties here: Do Not Sell or Share My Info
We see that you have already chosen to receive marketing materials from us. If you wish to change this at any time you may do so by clicking here.
Thank you for your continued interest in Progress. Based on either your previous activity on our websites or our ongoing relationship, we will keep you updated on our products, solutions, services, company news and events. If you decide that you want to be removed from our mailing lists at any time, you can change your contact preferences by clicking here.