You need to sign in to do that
Don't have an account?
dai tran 6
Can i use sObject in visualforce page?
Controller:
Can i use sObject in visualforce page?
public List<sObject> MyProducts {get;set;} public void search(){ string searchquery='select ProductCode,Name,ImageName__c,(Select UnitPrice,Pricebook2.Name From PricebookEntries where IsActive=True) from Product2 where name like \'%'+searchstring+'%\' Limit 20'; MyProducts= Database.query(searchquery); }visualforce page:
<apex:repeat value="{!MyProducts}" var="row"> <div > <apex:image width="100p" height="100p" value="{!URLFOR($Resource.ProductImage, 'ProductImage/' & Value(row.ImageName__c))}"></apex:image> <p> <apex:outputText >{!row.Name}</apex:outputText> <apex:repeat value="{!row.PricebookEntries}" var="PriceItem"> <apex:outputText >{!PriceItem.UnitPrice}</apex:outputText> </apex:repeat> </p> </div> </apex:repeat>
Can i use sObject in visualforce page?
All Answers
You can check below links for similar issue.
https://stackoverflow.com/questions/7335540/sobject-in-visualforce
https://salesforce.stackexchange.com/questions/38831/using-a-generic-sobject-in-visualforce-page/38836
Please mark it as solved if my reply was helpful, it will make it available
for others as a proper solution.
Best Regards,
Sandhya