This project is read-only.

Add link to page inside HTML section

Topics: Developer Forum, User Forum
Sep 18, 2009 at 1:13 PM

Is it not possible to link to other pages in the site, from inside a HTML section. ?

Sep 18, 2009 at 3:28 PM

I found a way :

Add the following to HtmlEditor.ascx.cs

        private FreeTextBoxControls.InsertHtmlMenu toolbardrop;


        Toolbar toolbar = new Toolbar();
        toolbardrop = new FreeTextBoxControls.InsertHtmlMenu();
        toolbardrop.Title = "Links";
        toolbardrop.ScriptBlock = @"this.ftb.InsertHtml(""<a href='/YourSite/default.aspx?pg="" + text + ""'>Limbo 19</a>"");";
        populateList(SiteMap.RootNode, 0, toolbardrop);
        toolbardrop.ScriptBlock = @"alert('text');";
        toolbar.Items.Add(toolbardrop);
        ftbEditor.Toolbars.Add(toolbar);


    private void populateList(SiteMapNode parentNode, int level, FreeTextBoxControls.InsertHtmlMenu toolbardrop)
    {
        foreach (SiteMapNode node in parentNode.ChildNodes)
        {
            if (node["pageId"] != null)
            {
                toolbardrop.Items.Add(new FreeTextBoxControls.ToolbarListItem(title, "<a href='/YourSite/default.aspx?pg=" + node["pageId"] + "'>" + node.Title + "</a>"));
                populateList(node, level + 1, toolbardrop);
            }
        }
    }

Sep 27, 2009 at 8:17 PM

For me the easiest way was to just give the three or four pages I wanted to link to a Virtual Path value  like   Download.aspx   or  Employement.aspx and then I could just add a url like http://www.mysite.com/Employment.aspx  and it would work for me.