Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

how to display the multiple children pages data in parent page episerver cms 7.5

Vote:
 

how display child page data in parent page episerver cms 7.5

#120845
Apr 27, 2015 8:04
Vote:
 

http://localhost:50099/Default.aspx

i want in above link  Announcements & Events how to display child pages images in parent page tell me guys

#120846
Apr 27, 2015 8:08
Vote:
 

PageData pdAnnouncements = GetPage(pgrefAnnouncements);
PageDataCollection rootBanner = GetChildren(pgrefAnnouncements);
DateTime dtExpiryDate;
foreach (PageData pd in rootBanner)
{
dtExpiryDate = Convert.ToDateTime(pd["ExpiryDate"]);
if (dtExpiryDate == DateTime.MinValue)
{
dtExpiryDate = DateTime.Now;
}
if ((System.DateTime.Now > pd.StartPublish) && (System.DateTime.Now < pd.StopPublish))
{
if (System.DateTime.Now.Date <= dtExpiryDate.Date)
{
if (pd.VisibleInMenu == true)
{
if ((System.DateTime.Now > pd.StartPublish) && (System.DateTime.Now < pd.StopPublish))
{
if (j == 3) { j = 1; } else { j++; }
i++;

if (i <= NoAnnouncement)
{
if (j % 2 == 0)
{
AnnouncementBlock2 = "<div class=\"announceBoxlft mdlMar\"><img src=\"{0}\" alt=\"\"><div class=\"blueOpacity\"><p>{1}</p> <a href=\"{2}\">read more</a></div><span><a id=\"bluOpacityHover\" href=\"{2}\">{1}</a></span></div>";

announcesrc2 = Convert.ToString(pd.Property["ThumbImage"]);
//announcesrc2 = UrlExtensions.ContentLink(null, pd.Property.ThumbImage) ?? string.Empty;
announceshortdesc2 = Convert.ToString(pd.Property["ShortDescription"])??string.Empty;
AnnouncementBlock2 = string.Format(AnnouncementBlock2, announcesrc2, announceshortdesc2, pd.LinkURL)??string.Empty;
AnnouncementBlock += AnnouncementBlock2;
}
else
{
AnnouncementBlock1 = "<div class=\"announceBoxlft\"><img src=\"{0}\" alt=\"\"><div class=\"blueOpacity\"><p>{1}</p> <a href=\"{2}\">read more</a></div><span><a id=\"bluOpacityHover\" href=\"{2}\">{1}</a></span></div>";
announcesrc1 = Convert.ToString(pd.Property["ThumbImage"]);
announceshortdesc1 = Convert.ToString(pd.Property["ShortDescription"]) ?? string.Empty;
AnnouncementBlock1 = string.Format(AnnouncementBlock1, announcesrc1, announceshortdesc1, pd.LinkURL) ?? string.Empty;
AnnouncementBlock += AnnouncementBlock1;
}
}
}
}

aboue the code not working

#120847
Edited, Apr 27, 2015 8:11
Vote:
 
<p>please tell me guys urgent i need</p>
#120852
Apr 27, 2015 9:27
Vote:
 

Suresh... I'm not quite following what your specific issue is within your series of posts, but regarding your initial post topic...

You can use the IContentRepository interface to get the children of a given ContentReference. For example, if you want to get all children of the StartPage as PageData, you could do this:

var repository = EPiServer.ServiceLocation.ServiceLocator.Current.GetInstance<IContentRepository>();
ContentReference pageLink = ContentReference.StartPage;
IEnumerable<PageData> pages = repository.GetChildren<PageData>(pageLink);

The EPiServer documentation is a great reference and starting point if you are having difficulties developing with EPiServer:
http://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-CMS/8/

Specifically for your issue, you can see the documentation on this page:
http://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-CMS/8/Content/IContentRepositoryDataFactory-interface/

---

As a side note, if you are continuing to have difficulties developing with EPiServer, I highly recommend looking into taking some training (see http://www.episerver.com/Training/). EPiServer has created a great course that covers developing with EPiServer... and if it's not available in your area, they have an online course as well!

#120902
Apr 27, 2015 19:08
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.