You need to sign in to do that
Don't have an account?
ravi kiran 87
can we bind a list value to a vf page, i'm trying to display the account and contact records on two different column without the relationship
public class YourController { public String GetAttributes { get; set; } public List<Vehicle> vehicles { get; set; } public YourController() { vehicles = new List<Vehicle>(); List<account> cars = [SELECT Id, Name, Description FROM account]; List<contact> planes = [SELECT Id, name , Title FROM contact]; for(account car : cars) { system.debug('car value in the loop ---> '+car.name); vehicles.add(new Vehicle(car)); } for(contact plane : planes) { system.debug('Plane value in the loop ---> '+plane.title); vehicles.add(new Vehicle(plane)); } } public List<contact> GetAttributes(){ List<contact> attr = [SELECT Name from contact limit 10]; return attr; } public class Vehicle { public Id id { get; set; } public string name { get; set; } public string name1{ get; set; } public Vehicle(account car) { // this.id = car.Id; this.name = car.name; // this.desc = car.desc; } public Vehicle(contact plane) { // this.id = plane.Id; this.name1 = plane.title; //this.desc = plane.desc; } } } ------------------ Vf Page <apex:page controller="YourController" > <apex:form > <apex:pageBlock ><apex:pageBlockTable value="{!vehicles}" var="vehicle"> <!--- <apex:column headerValue="Id" value="{!vehicle.id}" /> ---> <apex:column headerValue="FirstName" value="{!vehicle.name}" /> <apex:column headerValue="Name" value="{!vehicle.name1}" /> <apex:pageBlockSection title="Vitality Check Attributes"> <apex:pageBlock > <apex:repeat value="{!Attributes}" var="att"> </apex:repeat> </apex:pageBlock> </apex:pageBlockSection> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>