This project is read-only.

Adding a content To page

Topics: General
Sep 2, 2011 at 1:22 PM

I want to add the data through code to the Body part of the page. I am doing as below,

var ResptravelmenuItem = _contentManager.Create("MenuItem");
            ResptravelmenuItem.As<MenuPart>().MenuPosition = "6";
            ResptravelmenuItem.As<MenuPart>().MenuText = T("Responsible Travel").ToString();
            ResptravelmenuItem.As<MenuPart>().OnMainMenu = true;
            ResptravelmenuItem.As<MenuItemPart>().Url = "ResponsibleTravel";
            ResptravelmenuItem.As<BodyPart>().Text = T(@"<div class='caroselbanner'>
                                                    <div class='caroselbanner'>
                                                    <div class='banner'><img src='Modules/CentraLogic.Ecomantra.Common/Content/Images/inspireme_banner.gif' /></div>
                                                    <div class='divider'>&nbsp;</div>
                                                    <div class='banner'><img src='Modules/CentraLogic.Ecomantra.Common/Content/Images/tailortrips_banner.gif' /></div>


but its showing me the null reference Can Anybody tell Is this the correct way. or am i doing somthing wrong


Mourice Fargose


Sep 2, 2011 at 6:19 PM

A MenuItem doesn't have a body. It might be the case for Piotr's Advanced Menu module, but not sure though.