You need to sign in to do that
Don't have an account?
Harsha Shri
Populate list values into apex:select
Hi All,
I am getting record types by using below list
List<RecordType> recList= new List<RecordType>([select id, name from recordtype where sobjecttype='obj1__c']);
I want to show this values in apex:select. How can I do this
I tried some ways, but not working.
Please help me
Thanks in Advance!!
I am getting record types by using below list
List<RecordType> recList= new List<RecordType>([select id, name from recordtype where sobjecttype='obj1__c']);
I want to show this values in apex:select. How can I do this
I tried some ways, but not working.
Please help me
Thanks in Advance!!
Please check once below sample code :
Hope this helps you.
If it helps you please mark it as the best answer.
Thanks
Varaprasad
All Answers
Please find sample code in below Link :
https://developer.salesforce.com/forums/ForumsMain?id=9060G0000005P0vQAE
Hope this helps.
If it helps you please mark it as the best answer.
Thanks
Varaprasad
You could do something like this:
//In your constructor:
public List<SelectOption> options {get;set;}
//When you pull your query add them to the select option list:
List<RecordType> recList= new List<RecordType>([select id, name from recordtype where sobjecttype='obj1__c']);
for(RecordType rt : recList) {
options.add(new SelectOption(rt.Name));
//Then in your visualforce page simply reference options:
<apex:selectList value="{!options}" id="options"/>
//This is quite simplified but that should do the trick.
Good luck!
Jonathan
Hi Varaprasad,
Thank you very much for much for your help. Its working great
now when I select record type, I want show some fileds in output panel in same visualforce page. like rendering section based on record type.
how can I do this
Please check once below sample code :
Hope this helps you.
If it helps you please mark it as the best answer.
Thanks
Varaprasad
Hi Varaprasad,
Thank you very much for helping me
This is the controller class code you have given to me
I am not able to find out the method "selrecordtype" which you are refering in visualforce page.
Can you please help with this