You need to sign in to do that
Don't have an account?
Vijay Kumar Rebbala 11
Map values doesn't show on Visualforcepage
<apex:page controller="Testctrl"> <apex:form > <apex:repeat value="{!attdmap}" var="attdkey" > <apex:OutputText value="{!attdkey}"/> <apex:OutputText value="{!attdmap[attdkey]}"/> </apex:repeat> </apex:form> </apex:page> public class Testctrl { public list<Student__c> acctlist {get;set;} public Map<Student__c, Boolean> attdmap{get;set;} public Testctrl(){ Map<Student__c, Boolean> attdmap = new Map<Student__c, Boolean>(); acctlist = [SELECT Id, Name FROM Student__c]; for(Student__c atu23 : acctlist){ attdmap.put(atu23,false); } } }
Change your line 17 in the code to
Also, its not a best practice to use the SObject as the Key. that is not really a way to do it, maybe you can using a map of Id and Sobject.
Something like
All Answers
Here is the debug log,
<apex:page controller="Testctrl">
<apex:form >
<apex:repeat value="{!attdmap}" var="attdkey" >
<apex:OutputText value="{!attdkey.Name}"/>
<apex:OutputText value="{!attdmap[attdkey]}"/>
</apex:repeat>
<apex:commandButton action="{!submit}" value="Submit"/>
</apex:form>
</apex:page>
Change your line 17 in the code to
Also, its not a best practice to use the SObject as the Key. that is not really a way to do it, maybe you can using a map of Id and Sobject.
Something like