You need to sign in to do that
Don't have an account?
I can't do pageblocktable with this code
In this program i have doubt about pageblock table because i can't see details of object .pls solve my problem .
but it shows the error "Error: Unknown property String.price__c"
<apex:page standardController="rajesh__c">
<apex:form >
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:pageMessages ></apex:pageMessages>
<apex:commandButton action="{!save}" value="save"></apex:commandButton>
<apex:commandButton action="{!cancel}" value="cancel"></apex:commandButton>
</apex:pageBlockButtons>
<apex:pageBlockSection >
<apex:inputfield value="{!rajesh__c.name}"></apex:inputfield>
<apex:pageBlockTable value="{!rajesh__c.Name}" var="raj" >
<apex:column value="{!raj.price__c}"></apex:column>
<apex:column value="{!raj.subject__c}"></apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
In the <apex:pageBlockTable> component, you can pass list of primitive or non primitive data types. and the var attribute is used to represent the variable name for each row of the list passes in attribute "value"
<apex:pageBlockTable value="{!rajesh__c.Name}" var="raj" >
<apex:column value="{!raj.price__c}"></apex:column>
<apex:column value="{!raj.subject__c}"></apex:column>
The red highlighted value should be a list which has the Price and Subject as fields on it.
Let me know if it helps.
No sir there is nothing change it shows same problem
can u tell me clear idea about PAGEBLOCK TABLE WITH EXAMPLES pleas solve my problem iam too confusing .
http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_pageBlockTable.htm
why he assgins the "contacts" to the account
Understand it as...
You have a controller class (Apex Class). In this class you have a variable as
List<Contact> listContacts {get; set;}
you are getting contacts using a SOQL something like
listContacts = [SELECT Id, Name, Email FROM Contact];
Now you can use this list to render in table using pageblocktable..something like
<apex:pageBlockTable value="{!lsitContacts}" var="c">
<apex:column value="{!c.Name}"/>
<apex:column value="{!c.Email}"/>
</apex:pageBlockTable>
Let me know if it helps!
-P