Dropdown modification dynamically

Hi, I want to populate the dropdown based on the items i receive in my session.lastmessage.

Can anyone please help me to know if we can make the drop down dynamic ?? if so from where can i change the code. Please help