+ Start a Discussion
nishant shrivastava 40nishant shrivastava 40 

command button does not work after getting rendered

Hi,
i have a requirement, if first command button value 'check mapping for Attendee' is click, it should render a new button namely 'Import Attendee'. The problem is when i click first button if hundred times, it keeps the value of input file but when new rerender button got visible 'Import Attendee'. This button does not work on the same file. if i remove rerendered attributes from the 'Import Attendee' button. it works on input file as expected. but i want to show it after first button 'Check mapping for Attendee' clicked. I shall be grateful to you for your kind cooperation. Thanks in Advance.
i am getting for the rerendered attribute (attendee==true) from controller.

<apex:page standardController="ClickmeetingAttendee__c" extensions="ImportDataFromCSVController" title="Import Attendees Customers">
    <apex:form enctype="multipart/form-data">
        <apex:actionRegion>
            <apex:inputFile value="{!csvFileBody}"  filename="{!csvAsString}" id="In"/>
        </apex:actionRegion>
        <apex:pageBlock id="D">
            <apex:actionRegion immediate="true" renderRegionOnly="true">
            <apex:pageBlockSection columns="4">
                  <apex:commandButton value="Check Mapping for Attendee" action="{!importCSVFileAttendee}"/>
                  <apex:commandButton value="Check Mapping for Register" action="{!importCSVFileRegister}"/>
            </apex:pageBlockSection>
            <apex:pageblockTable value="{!CMAlistattendee}" var="AttendeeHeader" id="A" rendered="{!attendee==true}"> <!---- rendered="{!attendee==true}"----->
                <apex:column value="{!AttendeeHeader.Login__c}" headerValue="Login"/>
                <apex:column value="{!AttendeeHeader.E_mail__c}" rendered="{!If(!ISNULL(AttendeeHeader.E_mail__c),true,false)}" headerValue="Email"/>
                <apex:column value="{!AttendeeHeader.Starts_at__c}" headerValue="Starts At"/>
                <apex:column value="{!AttendeeHeader.Ends_at__c}" headerValue="Ends At"/>
                <apex:column value="{!AttendeeHeader.Rating_comment__c}" headerValue="Rating Comment"/>
                <apex:column value="{!AttendeeHeader.Role__c}" headerValue="Role"/>
                <apex:column value="{!AttendeeHeader.Device__c}" headerValue="Device"/>
                <apex:column value="{!AttendeeHeader.Vorname__c}" headerValue="First Name"/>
                <apex:column value="{!AttendeeHeader.Nachname__c}" headerValue="Last Name"/>
                <apex:column value="{!AttendeeHeader.E_Mail_Adresse__c}" headerValue="Email Address" rendered="{!If(!ISNULL(AttendeeHeader.E_Mail_Adresse__c),true,false)}"/>
                <apex:column value="{!AttendeeHeader.Unternehmensname__c}" headerValue="Company Name"/>
                <apex:column value="{!AttendeeHeader.Campaign__c}" headerValue="Campaign"/>
            </apex:pageblockTable>
            <apex:pageblockTable value="{!CMAlistsRegister}" var="AttendeeHeader" id="B" rendered="{!Register==true}">
                <apex:column value="{!AttendeeHeader.Room_ID__c}" headerValue="Room ID"/>
                <apex:column value="{!AttendeeHeader.Room_URL__c}" headerValue="Room URL"/> <!-----rendered ="{!If(!ISNULL(AttendeeHeader.E_mail__c),true,false)}"------>
                <apex:column value="{!AttendeeHeader.HTTP_Referer__c}" headerValue="HTTP Referer"/>
                <apex:column value="{!AttendeeHeader.Country__c}" headerValue="Country"/>
                <apex:column value="{!AttendeeHeader.City__c}" headerValue="City"/>
                <apex:column value="{!AttendeeHeader.E_Mail_Adresse__c}" headerValue="Email Address" rendered="{!If(!ISNULL(AttendeeHeader.E_Mail_Adresse__c),true,false)}"/>
                <apex:column value="{!AttendeeHeader.Vorname__c}" headerValue="First Name"/>
                <apex:column value="{!AttendeeHeader.Nachname__c}" headerValue="Last Name"/>
                <apex:column value="{!AttendeeHeader.Unternehmensname__c}" headerValue="Company Name"/>
                <apex:column value="{!AttendeeHeader.Registration_Date__c}" headerValue="Registration Date"/>
                <apex:column value="{!AttendeeHeader.Login_Url__c}" headerValue="Login URL"/>
                <apex:column value="{!AttendeeHeader.Campaign__c}" headerValue="Campaign"/>
            </apex:pageblockTable>
                <apex:pageBlockSection>
                <apex:commandButton value="Import Attendee" action="{!importCSVFile}" rendered="{!attendee==true}"/> <!---rendered="{!Attendee==true}"---->
                </apex:pageBlockSection>
            <apex:pageBlockSection>
                <apex:commandButton value="Import Registered User" action="{!importCSVFiles}" rendered="{!register==true}"/><!------ rendered="{!register==true}"----->
            </apex:pageBlockSection>
            <apex:image rendered="{!flag==true}" value="{!URLFOR($Resource.WellDone)}"/>
            <apex:image rendered="{!flags==true}" value="{!URLFOR($Resource.Excitedkid)}"/>
            <apex:pageMessages />
            </apex:actionRegion>
        </apex:pageBlock>
   </apex:form>
</apex:page>



Thanks :)
Akash ChavanAkash Chavan
Hello 
nishant shrivastava,
May be this will help you get your answer

<apex:commandButton value="Import Attendee"  rendered="{!importAttendee}"/>


In ImportDataFromCSVController extension write this code 

public Boolean importAttendee {get; set;}

// first make it default false.. it will not visible on page..
IN   ..................(ApexPages.StandardController controller){
importAttendee=False;
}

in method importCSVFileAttendee make it true like..
importAttendee=True;

If this method solve your issue then plz make it best answer !!!

Thanks,
Akash chavan
nishant shrivastava 40nishant shrivastava 40
Hi Akash,
Thanks for your kind response. i almost lost the hope of fixing it. Actually after your answer when i again visited the controller i checked that i have made the boolen importattendee a transient keywords and that's where it caused the problem. i am really thankful to you.