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
Kamatchi Devi RKamatchi Devi R 

Want to display table in force.com site dynamically through a custom custom controller and Vfpage

Hi,

 

I'm in need of displaying table dynamically in force.com site.

And created VF page and controller for this table VF page.

For this, I have a custom object called 'Directory__c" details in my account.

 

 

I created the table in VF page using the following code,

<apex:page controller="directory" showheader="false">
<br/>
<br/>
<apex:panelGrid columns="1" id="theGrid" width="50%" >
<apex:pageBlock >
<apex:form >
<apex:dataTable value="{!dir}" var="dir1" styleClass="list">

<apex:column >
<apex:facet name="header">Name</apex:facet>
<apex:outputText value="{!dir1.First_Name__c}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Phone</apex:facet>
<apex:outputText value="{!dir1.Phone_no__c}"/>
</apex:column>

</apex:dataTable>
</apex:form>
</apex:pageBlock>
</apex:panelGrid>
</apex:page>

 

Controller for the VF page is below,

public class directory {

Directory__c [] dir;
public List<Directory__c > getDir (){
if(dir== null){
dir= [select First_Name__c, Phone_no__c from Directory__c limit 10];
}
return dir;
}

 

}

 

 

The problem was the vf page is getting reflected in Salesforce.com while running as an Apex Vf page.

But, when i add this page to the force.com site and tried to run its not getting reflected.

 

Have anyone know the solution please reply me.

 

 

Thanks in Advance,

Kamatchi Devi.R

 

Best Answer chosen by Admin (Salesforce Developers) 
KaranrajKaranraj

Check the public access setting for the force.com site.

Check whether you enabled Read access to the object and other dependent object or class

All Answers

KaranrajKaranraj

Check the public access setting for the force.com site.

Check whether you enabled Read access to the object and other dependent object or class

This was selected as the best answer
Kamatchi Devi RKamatchi Devi R

Thank you karanraj.

 

In public access setting for site i didn't give field permission.Thats the problem.

Now its working...!

 

 

 

 

regards,

Kamatchi Devi R

KaranrajKaranraj
If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.

Don't forget to give Kudos if my previous post helps you.