You need to sign in to do that
Don't have an account?
Parth thakkar 9
i have to created dynamically page block .
now how i remove it dynamically.
See the picture when i click on red button that block i want remove.
Remove Dynamic created pageblock
i have to created dynamically page block .
now how i remove it dynamically.
See the picture when i click on red button that block i want remove.
Is it possible to post your code here for which I can help you .
Use below code may be it will help u.
<apex:page controller="InsertNumberOfRecords">
<apex:form>
<apex:pageBlock>
<apex:pageBlockTable value="{!allAcounts}" var="AllAcountsData" id="RefreshBlock">
<apex:column headerValue="Name">
<apex:inputtext value="{!AllAcountsData.name}"/>
</apex:column>
<apex:column headerValue="Active">
<apex:inputtext value="{!AllAcountsData.Active__c}"/>
</apex:column>
<apex:column headerValue="CustomerPriority">
<apex:inputtext value="{!AllAcountsData.CustomerPriority__c}"/>
</apex:column>
<apex:column headerValue="umberofLocations">
<apex:inputtext value="{!AllAcountsData.NumberofLocations__c}"/>
</apex:column>
<apex:column headerValue="SLA">
<apex:inputtext value="{!AllAcountsData.SLA__c}"/>
</apex:column>
<apex:column headerValue="SLA Exp">
<apex:inputtext value="{!AllAcountsData.SLAExpirationDate__c}"/>
</apex:column>
<apex:column headerValue="Phone">
<apex:inputtext value="{!AllAcountsData.Phone}"/>
</apex:column>
<apex:column headerValue="Rating">
<apex:inputtext value="{!AllAcountsData.Rating}"/>
</apex:column>
</apex:pageBlockTable>
<apex:pageBlockButtons>
<Apex:commandButton value="AllSave" action="{!SaveAllRecords}"/>
<Apex:commandButton value="AddRow" action="{!AddRow}" rerender="RefreshBlock"/>
<Apex:commandButton value="removerow" action="{!removerow}" rerender="RefreshBlock"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
public class InsertNumberOfRecords
{
public List<Account> allAcounts { get; set; }
public InsertNumberOfRecords()
{
Account newacc=new Account();
Account newacc1=new Account();
Account newacc2=new Account();
allAcounts =new list<Account>();
allAcounts .add(newacc);
allAcounts .add(newacc1);
allAcounts .add(newacc2);
}
public void AddRow()
{
Account newacc4=new Account();
allAcounts .add(newacc4);
}
public void removerow()
{
integer i=allAcounts .size();
if(i>1)
{
allAcounts.remove(i-1);
}
}
public void SaveAllRecords() {
insert allAcounts ;
}
}
Regards
Raj