function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Divya ChandrasekaranDivya Chandrasekaran 

Used output panel and not Working!

I have custom object called Login__c. I have a picklist field called User_type which has values as
Admin
Employee

I have two visualforce page one for Login authentication and other for Employee details.Once the login is success it will redirect to Employee Details page.
Based upon the User_type(Admin or Employee) it should show and hide a panel in the Employee detail page.

how to achieve this ?
ClintLeeClintLee
Use the rendered attribute on the apex:outputPanel.  Make sure the layout attribute is "block".

Like this:
 
<apex:outputPanel layout="block" rendered="{!User_Type__c = "Admin"}">
</apex:outputPanel> 

​<apex:outputPanel layout="block" rendered="{!User_Type__c = "Employee"}">
​</apex:outputPanel>

Hope that helps,

Clint
vibhor goelvibhor goel
Hi Divya,

U can use something as below:

In your controller create a variable which would have the value of the condition you need to check:
For example: 
boolean isAdmin{get;set;}
boolean isEmployee {get;set;}

In your constructor or any method you can assign these variables true or false after checking the condition.
for example:

if(Login__c.User_type== 'Admin'){ // for example only 
isAdmin = true;
}

then on your page u can use these variables to show hide any block:
<apex:outputPanel  rendered="{!isAdmin}">
</apex:outputPanel> 

​<apex:outputPanel  rendered="{!isEmployee }">
​</apex:outputPanel>


This is a very basic and not optimized way. Please provide your code snippet in case you want a very specific solution.

Hope It helps.

Vibhor