+ Start a Discussion
hemantgarghemantgarg 

Can we check map contains key on visualforce page ?

Can we check map contains key on visualforce page ?

S91084S91084

As far as my knowledge you cannot check if the map contains the key or not in visualforce page. Wht you can do is declare a string and when you create new entry to your map, add teh key value to that string variable.

 

on the visualforce page, check if the string contains the key and then display the map value

 

public String keyString {get;set;}

public Map<Id,Integer> mapValue {get;set;}

 

 

{!IF(contains(keyString,<keyValue>),mapValue[<keyValue>], '')}

PrakritiAdventuresPrakritiAdventures

Hi,

 

i have a rewuirement where i have to render a column based on the key of my map.

 

i was trying something like this

"{!IF(columnMap.containsKey('column1'),true,false)}"

 

can you please tell me how i can use your solution above for my scenario.

 

Thanks