You need to sign in to do that
Don't have an account?
GYAN ANDRUS
Hi Everyone..i want to edit the record vf page itself,Please help me,please update with my code
Apex page: <apex:page controller="DataTableEditRemoveController" tabStyle="Candidate__c"> <apex:form id="form" > <apex:pageBlock title="Candidates"> <apex:pageMessages ></apex:pageMessages> <apex:pageBlockTable value="{!accs}" var="row"> <apex:column > <apex:outputLink title="" value="/{!row.id}/e?retURL=/apex/{!$CurrentPage.Name}" style="font-weight:bold">Edit</apex:outputLink> | <a href="javascript:if (window.confirm('Are you sure?')) DeleteAccount('{!row.Id}');" style="font-weight:bold">Del</a> | <apex:outputLink title="" value="/{!row.id}/e?retURL=/apex/{!$CurrentPage.Name}" style="font-weight:bold">Update</apex:outputLink> | </apex:column> <apex:column value="{!row.Name}"/> <apex:column value="{!row.Department__c}"/> <apex:column value="{!row.DOB__c}"/> <apex:column value="{!row.Experience_Years__c}"/> <apex:column value="{!row.First_Name__c}"/> <apex:column value="{!row.Gender__c}"/> </apex:pageBlockTable> </apex:pageBlock> <apex:actionFunction action="{!DeleteAccount}" name="DeleteAccount" reRender="form" > <apex:param name="accountid" value="" assignTo="{!SelectedAccountId}"/> </apex:actionFunction> </apex:form> </apex:page> Controller: public class DataTableEditRemoveController { public List<Candidate__c> accs { get; set; } //used to get a hold of the account record selected for deletion public string SelectedAccountId { get; set; } public DataTableEditRemoveController() { //load account data into our DataTable LoadData(); } private void LoadData() { accs = [Select id, name,Department__c, DOB__c, Experience_Years__c, First_Name__c, Gender__c from Candidate__c limit 20]; } public void DeleteAccount() { // if for any reason we are missing the reference if (SelectedAccountId == null) { return; } // find the account record within the collection Candidate__c tobeDeleted = null; for(Candidate__c a : accs) if (a.Id == SelectedAccountId) { tobeDeleted = a; break; } //if account record found delete it if (tobeDeleted != null) { Delete tobeDeleted; } //refresh the data LoadData(); } }
</apex:pageblock>
if you add attribute mode=""inlineedit" to the pageblock we can edit the field .