Developer forum

Forum » Templates » Get ParagraphHeading inside item publisher template

Get ParagraphHeading inside item publisher template

Hans Ravnsfjall
Hans Ravnsfjall
Reply

Hi

I am trying to get the value of the paragraph header, when inside an ItemPublisher template. On a Page, I have used the API via PageVIew.Current method - But I can´t find/figure out what to use on Paragraphs?

Have also tried passing the paragraph header with ViewBag, but that does not seem to work either,

Any suggsetions?

/Hans


Replies

 
Nicolai Pedersen
Reply

Can you show your code in your template?

 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

Indeed

here is what i have tried - the viewbag is set in the Paragraph template. This is the ItemPublisher template.


@using System.Web.Mvc;
@using Dynamicweb.Frontend;
@{
var name = Dynamicweb.Frontend.ParagraphViewModel.Header;
}

<h1 class="cathead">
@name
@ViewBag.Heading
</h1>
 

 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

Nevermind, solved it

Solved it


@{

var paraid=GetInteger("ItemPublisher:Global.ParagraphId");
ParagraphService P = new ParagraphService();
string paragraphHeader=P.GetParagraph(@paraid).Header;
}
<h1>@paragraphHeader</h1>

/Hans

 

You must be logged in to post in the forum