You need to sign in to do that
Don't have an account?

WrapperClass, Checkbox, One Vfpage to other Vfpage.
I don't know where I am going wrong. I am being redirected to other Vfpage yet niether URL changes nor I am able to fetch the values from one Vfpage to other.
And I am using single controller for both Vfpages. Agony is I am getting two develpment mode windows of two visualforce page; when I click "edit".
Vfpage one
<apex:page controller="WrapperAccountextension">
<apex:form >
<apex:pageBlock title="Account List">
<apex:pageBlockButtons >
<apex:commandButton value="Edit" action="{!geteditormoz}" rerender="out"/>
</apex:pageBlockButtons>
<apex:pageBlockTable value="{!Accountsz}" var="Acc">
<apex:column headerValue="Action">
<apex:inputCheckbox value="{!Acc.selected}"/>
</apex:column>
<apex:column value="{!Acc.con.Name}" />
<apex:column value="{!Acc.con.Phone}" />
<apex:column value="{!Acc.con.Fax}"/>
<apex:column value="{!Acc.con.AnnualRevenue}"/>
<apex:column value="{!Acc.con.AccountNumber}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
=========================================================================================================================================================================================================================================================================================================================Vfpage two:-
<apex:page controller="WrapperAccountextension">
<apex:form >
<apex:pageblock mode="InlineEdit">
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!rasavez}"/>
</apex:pageBlockButtons>
<apex:pageBlockTable value="{!selectedAccountsz}" var="Rec" id="out" title="Selected Accounts" columnsWidth="400px,400px">
<apex:column headerValue="Account Name">
<apex:outputField value="{!Rec.name}"/>
</apex:column>
<apex:column headerValue="Phone">
<apex:outputField value="{!Rec.Phone}"/>
</apex:column>
<apex:column headerValue="Fax">
<apex:outputField value="{!Rec.Fax}"/>
</apex:column>
<apex:column headerValue="Annual Revenue">
<apex:outputField value="{!Rec.AnnualRevenue}"/>
</apex:column>
<apex:column headerValue="Account Number">
<apex:outputfield value="{!Rec.AccountNumber}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageblock>
</apex:form>
</apex:page>
=========================================================================================================================================================================================================================================================================================================================Controller:-
public class WrapperAccountextension {
Public pagereference rasavez(){
Update selectedAccountsz;
return null;
}
Public Pagereference editmoderz(){
return null;
}
public PageReference geteditormoz(){
Pagereference ldkedit = New PageReference('/apex/WrapperAccountlsteditera');
processSelectedz();
ldkedit.setRedirect(true);
return ldkedit;
}
public List<cAccountz> accListz {get; set;}
public List<Account> selectedAccountsz{get; set;}
//Adding the Records to inner class and to get the values for page block table.
public List<cAccountz> getAccountsz(){
if(accListz == null){
accListz = new List<cAccountz>();
for(Account acc : [select Id, Name, Phone,Fax,AnnualRevenue,AccountNumber from Account limit 25]){
accListz.add(new cAccountz(acc));
}
}
return accListz;
}
//on button click it will show the list of records what we have selected.
public PageReference processSelectedz(){
selectedAccountsz= new List<Account>();
for(cAccountz cCon : getAccountsz()) {
if(cCon.selected == true){
selectedAccountsz.add(cCon.con);
}
}
return null;
}
// Inner class for capture the records
public class cAccountz {
public Account con {get; set;}
public Boolean selected {get; set;}
public cAccountz(Account c) {
con = c;
selected = false;
}
}
}
Thanks and Regards,
Razzzaq.
Please try to remove the rendered Attribute from the command button , I think there is no use of rendered attribute here.
Hope this will work!!!
Thanks ,
Sagarika
All Answers
with below one, in your geteditormoz method.
It wont clear data in your view state and you should be able to get data in another page after redirection.
When controller is same for 2 pages, it is salesforce behaviour to not to change URL. But that should not be a major problem for you, I believe.
When I change it to "false" the Page is not being redirected to other Page.
Please try to remove the rendered Attribute from the command button , I think there is no use of rendered attribute here.
Hope this will work!!!
Thanks ,
Sagarika
And see what all debug are comings properly?
USER_DEBUG|[37]|DEBUG|==== THIRD ====
SYSTEM_METHOD_EXIT|[37]|System.debug(ANY)
CODE_UNIT_FINISHED|WrapperAccountextension invoke(geteditormoz)
VF_APEX_CALL|j_id4|{!geteditormoz}|PageReference:/apex/WrapperAccountlsteditera
CODE_UNIT_STARTED|[EXTERNAL]|01p900000061C5g|WrapperAccountextension get(selectedAccountsz)
SYSTEM_MODE_ENTER|true
CODE_UNIT_STARTED|[EXTERNAL]|01p900000061C5g|selectedAccountsz
CODE_UNIT_FINISHED|selectedAccountsz
CODE_UNIT_FINISHED|WrapperAccountextension get(selectedAccountsz)
VF_SERIALIZE_VIEWSTATE_BEGIN|VF_SERIALIZE_VIEWSTATE_END
CUMULATIVE_LIMIT_USAGE
Thanks Nishant for your Help. You really have been Helpful.