Discussions
- General Development
- Schema Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules
- Security
- Mobile
- Force.com Sites & Site.com
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby
- Desktop Integration
- APIs and Integrations
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- AppExchange Directory & Packaging
- Salesforce Labs & Open Source Projects
- Other Salesforce Applications
- Jobs Board
- Force.com Discussion Boards
- :
- Developer Boards for Force.com and Database.com
- :
- Visualforce Development
- :
- how to retrieve current page records into a pagebl...
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
how to retrieve current page records into a pageblock table when a add button clicks
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
03-21-2012 07:23 PM
in my page, we have enter values in fields and click the command button 'add', then tat record added to a pageblocktable and displays in the same page as a row of that table without saving in the database.can anyone suggest me to achieve this scenario.
Immediate reply will appreciable.
Thanks in advance...
Re: how to retrieve current page records into a pageblock table when a add button clicks
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
03-21-2012 10:34 PM
Hi,
Try below code snippet as reference:
------------------- Vf page-----------------
<apex:page controller="cls_wrapperexample" >
<apex:form >
Name : <apex:inputtext value="{!name}"/><br/>
Email : <apex:inputtext value="{!email}"/><br/>
Phone : <apex:inputtext value="{!phoneno}"/><br/>
<apex:commandButton reRender="pgtable" action="{!addnewrow}" value="Add New Row"/>
<apex:pageBlock >
<apex:pageBlockTable value="{!listaddrow}" id="pgtable" var="tt">
<apex:column ><apex:facet name="header">Name</apex:facet> {!tt.name1}</apex:column>
<apex:column ><apex:facet name="header">Email</apex:facet>{!tt.email1}</apex
<apex:column ><apex:facet name="header">Phone No</apex:facet>{!tt.phoneno1}</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
------------------------- Apex Controller -----------------------------
public class cls_wrapperexample
{
public string name{get;set;}
public string email{get;set;}
public string phoneno{get;set;}
public list<addrow> listaddrow{get;set;}
public cls_wrapperexample ()
{
listaddrow=new list<addrow>();
}
public void addnewrow()
{
addrow temp=new addrow();
temp.name1=name;
temp.email1=email;
temp.phoneno1=phoneno;
listaddrow.add(temp);
}
public class addrow
{
public string name1{get;set;}
public string email1{get;set;}
public string phoneno1{get;set;}
}
}
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
Navatar Group
Re: how to retrieve current page records into a pageblock table when a add button clicks
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
03-21-2012 11:30 PM
its show an error...
invalid field for the object.

