Apex:
public
class coun {
public Boolean hide = false;
public Boolean hide1 = false;
public Boolean hide2 = false;
public void setMhide(Boolean b) {
this.hide = b;
}
public Boolean getMhide() {
return this.hide;
}//Passing input dynamically through
another method
public Boolean getM1hide() {
return this.hide2;
}
public void setM1hide(Boolean b) {
this.hide2 = b;
}
public Boolean getM2hide() {
return this.hide1;
}
public void setM2hide(Boolean b) {
this.hide1 = b;
}
public PageReference india() {
setMhide(true);
setM2hide(false);
setM1hide(false);
return null;
}//displaying only india information and hiding other information
setMhide(true);
setM2hide(false);
setM1hide(false);
return null;
}//displaying only india information and hiding other information
public PageReference us() {
setM1hide(true);
setM2hide(false);
setMhide(false);
return null;
}
public PageReference uk() {
setM2hide(true);
setM1hide(false);
setMhide(false);
return null;
}
}
Vf Page:
<apex:page
controller="coun">
<apex:form
>
<apex:commandButton
value="India" action="{!india}"
reRender="India,Us,Uk"/>
<apex:commandButton
value="Us" action="{!us}" reRender="India,Us,Uk"/>
<apex:commandButton
value="Uk" action="{!uk}" reRender="India,Us,Uk"/>
<apex:pageBlock
>
<apex:outputPanel id="India">
<apex:pageBlockSection title="India" rendered="{!mhide}">
</apex:pageBlockSection>
</apex:outputPanel>
<apex:pageBlockSection title="India" rendered="{!mhide}">
</apex:pageBlockSection>
</apex:outputPanel>
<apex:outputpanel
id="Us">
<apex:pageBlockSection
title="US" rendered="{!m1hide}">
</apex:pageBlockSection>
</apex:outputpanel>
<apex:outputpanel
id="Uk">
<apex:pageBlockSection
title="UK" rendered="{!m2hide}">
</apex:pageBlockSection>
</apex:outputpanel>
</apex:pageBlock>
</apex:form>
</apex:page>
No comments:
Post a Comment