function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
bluecapbluecap 

Dynamic Includes - Unknown Property

Hi all,

Hoping you all can help me. Im trying to dynamically display (include) X number of visual force pages on a single parent page. Im getting the following error when I try to save the VF code below:
 
<apex:repeat value="{!strings}" var="str" id="theRepeat"> 
	<apex:include pageName="{!str}"/>
</apex:repeat>
...
public String[] getStrings() {
        return new String[]{'pagename1','pagename2'};
}
...

ERROR:
Result: [COMPILE FAILED]: (MyDashboard) Unknown property 'ctrl_MyPage.str'  (Line: 1, Column: -1)

All suggestions are appreciated.

Thanks!






 
Best Answer chosen by bluecap
venkat-Dvenkat-D
use apex:iframe in place of apex:include and try it out.

All Answers

venkat-Dvenkat-D
can you post full code of page and controller ..
bluecapbluecap
<apex:page showHeader="false" sidebar="false" applyHtmlTag="false" docType="html-5.0" standardStylesheets="false" controller="ctrl_MyPage">

<apex:repeat value="{!strings}" var="str" id="theRepeat"> 
	<apex:include pageName="{!str}"/>
</apex:repeat>

</apex:page>
 
public with sharing class ctrl_MyPage {
	public ctrl_MyPage() { 

	}

    public String[] getStrings() {
       return new String[]{'pagename1','pagename2'};
    }
}

Here you go..
bluecapbluecap
After searching a bit more though, and although I didn't get the same error message, this is probably not possible.

http://salesforce.stackexchange.com/questions/15622/include-component-seems-to-be-having-issues-with-merge-field-syntax-inside-of-a


 
venkat-Dvenkat-D
Did you create two vf pages with names pagename1 and pagename2?
bluecapbluecap
Yes - here they are...

pagename1
<apex:page >
  <!-- Begin Default Content REMOVE THIS -->
 <b>Hello!</b>
   <!-- End Default Content REMOVE THIS -->
</apex:page>

pagename2
 
<apex:page >
  <!-- Begin Default Content REMOVE THIS -->
 <b>Hello !</b>
   <!-- End Default Content REMOVE THIS -->
</apex:page>



 
venkat-Dvenkat-D
use apex:iframe in place of apex:include and try it out.
This was selected as the best answer
bluecapbluecap
Thanks - that seems to be working within the loop. Now I just need to see if I can get the parent and children to behave properly. Some of the child windows will have buttons for editing/creating new records, so I'll likely need to popup modal windows over the parent. That will be the next challenge.

Thanks for your help on this!