Developer forum

Forum » CMS - Standard features » @RenderParagraphContent() - render "controllable" field

@RenderParagraphContent() - render "controllable" field

Hans Ravnsfjall
Hans Ravnsfjall
Reply

Hi

Am trying to do something like

@RenderParagraphContent(@GetInteger(Item.LinkToParagraphToRender))

But this does not work. Is there a way to make a solution where the user can use the paragraph-picker to select a paragraph to render, like I am trying to achieve above?

br.

Hans


Replies

 
Mario Santos Dynamicweb Employee
Mario Santos
Reply

Hi Hans,

I've been using it without any issues.
What is the value you are getting from GetInteger(Item.LinkToParagraphToRender)? Where are you trying to add this, paragraph/layout/module template?

BR, Mário

 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

Hi

Yes, this has worked fine up until we had to update to version 9.3.6 because of another issue

I use it in a paragraph template - are you using it on a new version of DW?

br

Hans

 
Mario Santos Dynamicweb Employee
Mario Santos
Reply

Hi Hans,

Yes, I'm using it on DW 9.3.6 on master and paragraph templates, and both are working.
Did you checked the returned value from your GetInteger("Item.LinkToParagraphToRender")?

BR, Mário

 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

I am getting an integer out. Found out the error was because the field was empty, so that makes sense that it wont render paragrapid=0

 

But it doesnt work. I guess it´s because it is "Nested" that it doesn´t work? How do you use it?

 

This is the code i use

 

 
           @if(!String.IsNullOrEmpty(@GetString("Item.Innihaldsoki"))){
          paragraphid=@GetString("Item.Innihaldsoki");
          paragraphid=paragraphid.Substring(paragraphid.LastIndexOf("#")+ 1);
          int pid=Int32.Parse(@paragraphid);
          @RenderParagraphContent(@pid); 
   }

 

You must be logged in to post in the forum