you didn't use inlineedit in pageblocksection. you have used this into in outfield..I want to know how can we use inline edit support in pageblocksection..
/////////////////////////// Controller ////////////////////////////////////////////// public class relatedCon { public list<contact> ConDetail1{get;set;} public list<wrapCon> ConDetail{get;set;} public id conId{get;set;} public relatedCon() { ConDetail=new list<wrapCon>(); ConDetail1=[select id,accountid,lastname from contact where accountid =: ApexPages.currentPage().getParameters().get('id')]; system.debug('@@@@@@@@@@@@@@@@' +ConDetail1.size()); for(contact w : ConDetail1) { ConDetail.add(new wrapCon(w));
} system.debug('%%%%%%%%%%%%%%%%%%%%%%%' +ConDetail); } public void Update1() { system.debug('@@@@@@@@-------0th last--------@@@@@@@@@' +ConDetail[0].con.lastname); system.debug('@@@@@@@@-------1st last--------@@@@@@@@@' +ConDetail[1].con.lastname); system.debug('@@@@@@@@-------2nd last--------@@@@@@@@@' +ConDetail[2].con.lastname); system.debug('@@@@@@@@@@@@@@@@@' +conId); contact con2=new contact(id=conId); con2.lastname=ConDetail[0].con.lastname; con2.accountid=ConDetail[0].con.accountid; update con2; } public void edit() { } public class wrapCon { public contact con{get;set;} public wrapCon(contact con1) { con=con1; } } }
Hi,
Use below code snippets as reference
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
you didn't use inlineedit in pageblocksection. you have used this into in outfield..I want to know how can we use inline edit support in pageblocksection..
Hi,
Use this code as reference:
////////////////////////// VF Page /////////////////////////////////////////
<apex:page controller="relatedCon" id="p1">
<apex:form >
<apex:outputPanel id="Panel1">
<apex:repeat value="{!ConDetail}" var="c" >
<apex:inlineEditSupport showOnEdit="Update"
hideOnEdit="editButton" event="ondblclick"
changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>
<!-- <apex:pageBlock >
<apex:pageBlockButtons >
<apex:commandButton action="{!edit}" id="editButton" value="Edit"/>
<apex:commandButton action="{!Update1}" id="saveButton" value="Save" reRender="opanel1">
<apex:param name="ConId" value="{!c.id}" assignTo="{!ConId}"/></apex:commandbutton>
<apex:commandButton onclick="resetInlineEdit()" id="cancelButton" value="Cancel"/>
</apex:pageBlockButtons>
</apex:pageBlock>-->
<table width="100%" border="0" id="t1">
<tr><td width="25%"><b>Account Name</b></td>
<td width="25%">
<apex:outputField value="{!c.con.accountid}"/>
<!--<apex:inlineEditSupport showOnEdit="Update"
hideOnEdit="editButton" event="ondblclick"
changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/></apex:outputField>-->
</td></tr>
<tr><td width="25%"><b>Contact LastName</b></td>
<td width="25%">
<apex:outputField value="{!c.con.lastname}"/>
<!--<apex:inlineEditSupport showOnEdit="Update"
hideOnEdit="editButton" event="ondblclick"
changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/></apex:outputField>-->
</td></tr>
<tr><td width="25%"><b>Contact ID</b></td>
<td width="25%">
<apex:outputField value="{!c.con.id}"/></td></tr>
</table> <br/>
<center><apex:commandButton value="Update" action="{!Update1}" reRender="p1">
<apex:param name="ConId" value="{!c.con.id}" assignTo="{!ConId}"/>
</apex:commandButton></center>
<hr/>
</apex:repeat>
</apex:outputPanel>
</apex:form>
</apex:page>
/////////////////////////// Controller //////////////////////////////////////////////
public class relatedCon
{
public list<contact> ConDetail1{get;set;}
public list<wrapCon> ConDetail{get;set;}
public id conId{get;set;}
public relatedCon()
{
ConDetail=new list<wrapCon>();
ConDetail1=[select id,accountid,lastname from contact where accountid =: ApexPages.currentPage().getParameters().get('id')];
system.debug('@@@@@@@@@@@@@@@@' +ConDetail1.size());
for(contact w : ConDetail1)
{
ConDetail.add(new wrapCon(w));
}
system.debug('%%%%%%%%%%%%%%%%%%%%%%%' +ConDetail);
}
public void Update1()
{
system.debug('@@@@@@@@-------0th last--------@@@@@@@@@' +ConDetail[0].con.lastname);
system.debug('@@@@@@@@-------1st last--------@@@@@@@@@' +ConDetail[1].con.lastname);
system.debug('@@@@@@@@-------2nd last--------@@@@@@@@@' +ConDetail[2].con.lastname);
system.debug('@@@@@@@@@@@@@@@@@' +conId);
contact con2=new contact(id=conId);
con2.lastname=ConDetail[0].con.lastname;
con2.accountid=ConDetail[0].con.accountid;
update con2;
}
public void edit()
{
}
public class wrapCon
{
public contact con{get;set;}
public wrapCon(contact con1)
{
con=con1;
}
}
}
Refere this example
http://www.salesforceworld.blogspot.com/2011/06/inline-editing-in-visualforce-page.html
If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.