+ Start a Discussion
RamakarryRamakarry 

Display Map elements on PageblockTable

Hai friends! 
While displaying map values on a pageblock table every time i m getting below error...can any body help me how to understand this and fix?
Error:
Incorrect parameter type for subscript. Expected java.lang.Class, received DateTime
Error is in expression '{!eventmap[key]}' in component <apex:pageBlock> in page 
My code is:
<apex:page controller="DisplaySectionsController11">
<apex:form >
<apex:repeat value="{!eventmap}" var="key">
<apex:pageBlock title="{!key}">
<apex:pageblocktable value="{!eventmap[key]}" var="a">
<apex:column value="{!a.Subject}"/>
<apex:column value="{!a.Startdatetime}"/>
<apex:column value="{!a.Enddatetime}"/>
</apex:pageBlock>
</apex:repeat>
<apex:commandButton value="ss" action="{!Query}"/>
</apex:form>
</apex:page>
reymagdaongreymagdaong
Hi,
Seems fine to me except that the pageblocktable doesnt have an ending tag. Can you please share the controller class of this? thanks.
 
sai kallurisai kalluri
public class Childparsql2
{
    Public Map<List<String>,List<Contact>> mapre {set;get;}
    
    public List<Contact> cnts {set;get;}
    public List<String> strngs {set;get;}
    List<Contact> c1 {set;get;}
    
    public void meth1()
    {
        cnts = [select firstname,lastname,Account.name,Account.industry from Contact];
        strngs =new List<String>();
        mapre = new Map<List<String>,List<Contact>>();
        c1 =  new List<Contact>();
        
        for(Contact c:  cnts)
        {
          strngs.add(c.FirstName);
            c1.add(c);
            
        }
        mapre.put(strngs, c1);
        
       
    }

}


Hi ,

Can anyone guide me how to diaplay mapre (map result using page block table)
How to dispaly Map<List<String>,List<Contact>> using pageblock table