AI OnAI Off
<%#Container.CurrentPage.PageName%>
<%-- The Trick is to feed this list with the correct PageDataCollection --%>
Also available in:
<%# GetLanguageDisplayName(Container.CurrentPage.LanguageBranch) %>
The inner list will query for it's own page data collection based on the current page. But to get this list, we create a method in the code behind file to gather the data. You already have the GetLanguageDisplayName() method, so the only additional one you need is this:
// This is practically the same code as in the previous thread, but
// put into its own method so we can reuse it.
public PageDataCollection GetLanguageVersions(PageData currentPage)
{
PageDataCollection langVersions = Global.EPDataFactory.GetLanguageBranches(currentPage.PageLink);
PageDataCollection pagesWithPdfLinks = new PageDataCollection();
foreach (PageData page in langVersions)
{
// Check that it is not the same lang as the currently loaded one
// Also check that the page has a value for the pdf link
if (currentPage.LanguageBranch != page.LanguageBranch &&
page["varFilePath"] != null)
{
// We have a language version of the page
pagesWithPdfLinks.Add(page);
}
}
// That's it - return it
return pagesWithPdfLinks;
}
public PageDataCollection pagesWithPdfLinks = new PageDataCollection(); public PageDataCollection langVersions; public string LanguageVersion(PageData pd) { string _languageName; // Only brain compiled - put it into PageLoad langVersions = Global.EPDataFactory.GetLanguageBranches(pd.PageLink); foreach (PageData page in langVersions) { pagesWithPdfLinks.Add(page); } lstPdfLinks.DataSource = pagesWithPdfLinks; lstPdfLinks.DataBind(); return pd.PageName; }