You need to sign in to do that
Don't have an account?
Diaplay Record Type in visualforce page
Hi every body,
I want to display Record Type in Visualforce page. But how, i tried this but it doen`t work.

My Code:
I want to display Record Type in Visualforce page. But how, i tried this but it doen`t work.
My Code:
<apex:page standardController="Project_Task__c" extensions="projectTaskController" action="{!runSearch}" showHeader="false" standardStylesheets="true" sidebar="false" applyHtmlTag="false" applyBodyTag="false" docType="html-5.0" > <apex:form > <apex:pageMessages id="errors" /> <apex:pageBlock title="Find Project Task" mode="edit"> <apex:pageBlockButtons location="top"> <apex:commandButton value="New Project Task " action="{!create}"/> </apex:pageBlockButtons> <table width="100%" border="0"> <tr> <td width="200" valign="top"> <apex:pageBlock title="Parameters" mode="edit" id="criteria"> <script type="text/javascript"> function doSearch() { searchServer( document.getElementById("ProjectTaskName").value, document.getElementById("LeaveType").options[document.getElementById("LeaveType").selectedIndex].value); } </script> <apex:actionFunction name="searchServer" action="{!runSearch}" rerender="results,debug,errors"> <apex:param name="ProjectTaskName" value="" /> <apex:param name="LeaveType" value="" /> </apex:actionFunction> <table cellpadding="2" cellspacing="2"> <tr> <td style="font-weight:bold;">Project Task Name<br/> <input type="text" id="ProjectTaskName" onkeyup="doSearch();"/> </td> </tr> <tr> <td style="font-weight:bold;">Leave Type<br/> <select id="LeaveType" onchange="doSearch();"> <option value=""></option> <apex:repeat value="{!LeaveType}" var="tech"> <option value="{!tech}">{!tech}</option> </apex:repeat> </select> </td> </tr> </table> </apex:pageBlock> </td> <td valign="top"> <apex:pageBlock mode="edit" id="results"> <apex:pageBlockTable value="{!projectTask}" var="pt"> <apex:column headerValue="Action" style="float:right;width:90%"> <apex:outputLink style="Color:blue" value="{!URLFOR($Action.Project_Task__c.Edit,pt.Id)}"> Edit </apex:outputLink> </apex:column> <!--<apex:column > <apex:facet name="header"> <apex:commandLink value="Code" action="{!toggleSort}" rerender="results,debug"> <apex:param name="sortField" value="Name" assignTo="{!sortField}"/> </apex:commandLink> </apex:facet> <apex:outputField value="{!pt.Name}"/> </apex:column>--> <apex:column > <apex:facet name="header"> <apex:commandLink value="Project Task Name" action="{!toggleSort}" rerender="results,debug"> <apex:param name="sortField" value="Project Name" assignTo="{!sortField}"/> </apex:commandLink> </apex:facet> <apex:outputField value="{!pt.Project_Task_Name__c}"/> </apex:column> <apex:column > <apex:facet name="header"> <apex:commandLink value="Project Name" action="{!toggleSort}" rerender="results,debug"> <apex:param name="sortField" value="Project Name" assignTo="{!sortField}"/> </apex:commandLink> </apex:facet> <apex:outputField value="{!pt.pro_has_many_protask__c}"/> </apex:column> <apex:column > <apex:facet name="header"> <apex:commandLink value="Leave Type" action="{!toggleSort}" rerender="results,debug"> <apex:param name="sortField" value="Leave Type" assignTo="{!sortField}"/> </apex:commandLink> </apex:facet> <apex:outputField value="{!pt.Leave_Type__c}"/> </apex:column> <apex:column > <apex:facet name="header"> <apex:commandLink value="Reccord Type" action="{!toggleSort}" rerender="results,debug"> <apex:param name="sortField" value="Reccord Type" assignTo="{!sortField}"/> </apex:commandLink> </apex:facet> <apex:outputField value="{!pt.RedordType}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </td> </tr> </table> </apex:pageBlock> </apex:form> </apex:page>
Make sure you retrieve the same in your SOQL query when querying for RecordType i.e
Best.
i) Leave
ii) Holiday
ii) Sick
Now, my question is; how to retrieve them with SOQL individually. Please can you help me.
This is my code:
SOQL:soql = 'select Name,Project_Task_Name__c,Project__c,Leave_Type__c,Time_Duration__c,RecordType.Name,pro_has_many_protask__c from Project_Task__c where Name !=null AND SObjectType='Leave'';
But it doesn`t work.
And this is the page display after adding the code:
Hi Santi
I am Writing Some Links.
Please follow these links .It will help you
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Suraj Tripathi