+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Generating a list

Generating a list

4 posts, 0 answered
  1. Tony
    Tony avatar
    2 posts
    Registered:
    25 Jul 2013
    07 Feb 2014
    Link to this post
    Is there a reasonably easy way I can generate a list of address to all the landing pages used for eMarketing (pages not acceptable though site links).
  2. Vasya Stankova
    Vasya Stankova  avatar
    12 posts
    Registered:
    03 Nov 2014
    10 Feb 2014
    Link to this post
    Hello Tony,

    Thank you for contacting Sitefinity support.

    Would you please explain in detail what you mean by landing pages and not acceptable though site links?

    Thank you in advance for your patience and cooperation.

    Regards,
    Vasya Stankova
    Telerik
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
  3. Tony
    Tony avatar
    2 posts
    Registered:
    25 Jul 2013
    07 Mar 2014 in reply to Vasya Stankova
    Link to this post

    Hi,

    Thanks for responding, I'm basically trying to generate a list of specific pages. For example, I want to export a list of landing pages we've published (these pages shouldn't be acceptable without an emailed link or CMS login). I can sign into Sityfinity (3.7) and select "Pages" from the menu, this allows me to view the complete site map but I was wondering if I can export a list of certain pages from here.

  4. Ivelina Ganeva
    Ivelina Ganeva avatar
    4 posts
    Registered:
    07 Jul 2016
    10 Mar 2014
    Link to this post
    Hello,

    You can use the following code example to create user control and find all pages using Sitefinity API.

    GetAllPages.ascx
    <%@ Control Language="C#" AutoEventWireup="true" Inherits="UserControls_Public_SiteImporter_GetPages" Codebehind="GetAllPages.ascx.cs" %>
    <%@ Register TagPrefix="telerik" Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" %>
     
    <telerik:RadGrid ID="rgPages" runat="server">
        <MasterTableView AutoGenerateColumns="false" >
            <Columns>
                <telerik:GridTemplateColumn HeaderText="Menu Name">
                    <ItemTemplate>
                        <asp:Label ID="lblMenuName" runat="server" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="Page Id">
                    <ItemTemplate>
                        <asp:Label ID="lblPageId" runat="server" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="Parent Page Id">
                    <ItemTemplate>
                        <asp:Label ID="lblParentPageId" runat="server" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="Url">
                    <ItemTemplate>
                        <asp:Label ID="lblUrl" runat="server" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="Url Redirects">
                    <ItemTemplate>
                        <asp:Label ID="lblUrlRedirets" runat="server" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>
     
    <asp:Button ID="btnExportToExcel" Text="Export to Excel" runat="server" />

    GetAllPages.ascx.cs
    public partial class GetPages : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            btnExportToExcel.Click += new EventHandler(btnExportToExcel_Click);
            rgPages.ItemCreated += new Telerik.Web.UI.GridItemEventHandler(rgPages_ItemCreated);
     
            if (!IsPostBack)
            {
                CmsManager manager = new CmsManager();
                rgPages.DataSource = manager.GetPages();
                rgPages.DataBind();
            }
        }
     
        void rgPages_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
            switch (e.Item.ItemType)
            {
                case GridItemType.AlternatingItem:
                case GridItemType.Item:
                    {
                        ICmsPage cmsPage = (ICmsPage)e.Item.DataItem;
                        Label lblMenuName = (Label)e.Item.FindControl("lblMenuName");
                        Label lblPageId = (Label)e.Item.FindControl("lblPageId");
                        Label lblParentPageId = (Label)e.Item.FindControl("lblParentPageId");
                        Label lblUrl = (Label)e.Item.FindControl("lblUrl");
                        Label lblUrlRedirets = (Label)e.Item.FindControl("lblUrlRedirets");
     
                        lblMenuName.Text = cmsPage.MenuName;
                        lblPageId.Text = cmsPage.ID.ToString();
                        lblParentPageId.Text = cmsPage.ParentID.ToString();
     
                        StringBuilder sbUrlsRedirects = new StringBuilder();
                        foreach (ICmsUrl url in cmsPage.Urls)
                        {
                            sbUrlsRedirects.AppendLine(url.Url);
                        }
     
                        lblUrlRedirets.Text = sbUrlsRedirects.ToString();
                        lblUrl.Text = cmsPage.DefaultUrl.Url;
                    }
                    break;
            }
        }
     
        void btnExportToExcel_Click(object sender, EventArgs e)
        {
            rgPages.MasterTableView.ExportToExcel();
        }
    }

    Hope this is helpful.

    Regards,
    Ivelina Ganeva
    Telerik
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
Register for webinar
4 posts, 0 answered