-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
4Questions
-
3Replies
Here i am not getting Account Id
<apex:page standardController="Account" extensions="contrller">
<apex:form >
<apex:pageblock >
<!-- Display Account related Contacts -->
<apex:pageBlockTable value="{!relatedContacts}" var="val">
<apex:column value="{!val.name}"/>
<apex:column value="{!val.email}"/>
</apex:pageBlockTable>
</apex:pageblock>
</apex:form>
</apex:page>
_________controller_______________
public with sharing class contrller {
Public id Current_Acc_Id;
public contrller(ApexPages.StandardController controller) {
Current_Acc_Id = controller.getRecord().id;
system.debug('--------------------Current_Acc_Id------------------------'+Current_Acc_Id );
}
public List<Contact> getrelatedContacts(){
List <contact> conList = New List<Contact>();
system.debug('--------------------Current_Acc_Id------------------------'+Current_Acc_Id );
for(Account acc:[select id,name,(select name,id,email from contacts) from account where id=:Current_Acc_Id])
{
for(contact con:acc.contacts)
conList.add(con);
}
return conList;
}
no records are displayed
<apex:form >
<apex:pageblock >
<!-- Display Account related Contacts -->
<apex:pageBlockTable value="{!relatedContacts}" var="val">
<apex:column value="{!val.name}"/>
<apex:column value="{!val.email}"/>
</apex:pageBlockTable>
</apex:pageblock>
</apex:form>
</apex:page>
_________controller_______________
public with sharing class contrller {
Public id Current_Acc_Id;
public contrller(ApexPages.StandardController controller) {
Current_Acc_Id = controller.getRecord().id;
system.debug('--------------------Current_Acc_Id------------------------'+Current_Acc_Id );
}
public List<Contact> getrelatedContacts(){
List <contact> conList = New List<Contact>();
system.debug('--------------------Current_Acc_Id------------------------'+Current_Acc_Id );
for(Account acc:[select id,name,(select name,id,email from contacts) from account where id=:Current_Acc_Id])
{
for(contact con:acc.contacts)
conList.add(con);
}
return conList;
}
no records are displayed
- geetha b 8
- November 10, 2014
- Like
- 0
- Continue reading or reply
I want to get the selected row i:e the checked row from the page block table,my code is throwing error
public class testWrapper
{
public List<Wrapper> books{get; set;}
public integer count=0;
public boolean checked;
public testWrapper()
{
books = new List<Wrapper>();
for(Book__c b1 : [select name,Price__c from Book__c])
{
books.add(new Wrapper(b1));
}
}
public PageReference deleterow()
{
for(wrapper wp : books)
{
count=count+1;
if (wp.checked==true)
{
books.remove(count);
}
}
return null;
}
/*
public void selectedrows()
{
for(wrapper wp : books)
{
if (wp.checked==true)
{
}}
system.debug('no of rows selected'+count);
}
Public list<wrapper> getbooks()
{
books = new List<Wrapper>();
for(Book__c b1 : [select name,Price__c from Book__c])
{
books.add(new Wrapper(b1));
}
return books;
} */
public class Wrapper
{
public boolean checked {get; set;}
public Book__c bks {get; set;}
public Wrapper(Book__c bl)
{
this.bks = bl;
this.checked = false;
}
}
}
it is throwin this error
System.FinalException: Cannot modify a collection while it is being iterated.
Error is in expression '{!deleterow}' in component <apex:commandButton> in page testwrapper: Class.testWrapper.deleterow: line 20, column 1
Class.testWrapper.deleterow: line 20, column 1
{
public List<Wrapper> books{get; set;}
public integer count=0;
public boolean checked;
public testWrapper()
{
books = new List<Wrapper>();
for(Book__c b1 : [select name,Price__c from Book__c])
{
books.add(new Wrapper(b1));
}
}
public PageReference deleterow()
{
for(wrapper wp : books)
{
count=count+1;
if (wp.checked==true)
{
books.remove(count);
}
}
return null;
}
/*
public void selectedrows()
{
for(wrapper wp : books)
{
if (wp.checked==true)
{
}}
system.debug('no of rows selected'+count);
}
Public list<wrapper> getbooks()
{
books = new List<Wrapper>();
for(Book__c b1 : [select name,Price__c from Book__c])
{
books.add(new Wrapper(b1));
}
return books;
} */
public class Wrapper
{
public boolean checked {get; set;}
public Book__c bks {get; set;}
public Wrapper(Book__c bl)
{
this.bks = bl;
this.checked = false;
}
}
}
it is throwin this error
System.FinalException: Cannot modify a collection while it is being iterated.
Error is in expression '{!deleterow}' in component <apex:commandButton> in page testwrapper: Class.testWrapper.deleterow: line 20, column 1
Class.testWrapper.deleterow: line 20, column 1
- geetha b 8
- November 04, 2014
- Like
- 0
- Continue reading or reply
Please resolve my problem in wrapper class
Here is mu code
<apex:page controller="testWrapper">
<!-- Using wrapper class -->
<apex:form>
<apex:pageBlockSection>
<apex:pageBlockTable value="{!books}" var="b">
<apex:column width = "25px">
<apex:inputCheckbox value="{!b.checked}" />
</apex:column>
<apex:column value="{!b.b1.Name}"/>
<apex:column value="{!b.b1.Price__c}"/>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:form>
</apex:page>
---------------------------------------------------class--------------------------------------------------
public class testWrapper
{
public List<Wrapper> books{get; set;}
public testWrapper()
{
books = new List<Wrapper>();
for(Book__c b1 : [select name,Price__c from Book__c])
{
books.add(new wrapper(b1));
}
}
public class Wrapper
{
public boolean checked {get; set;}
public Book__c bl {get; set;}
public Wrapper(Book__c bl)
{
this.bl = bl;
this.checked = false;
}
}
}
<apex:page controller="testWrapper">
<!-- Using wrapper class -->
<apex:form>
<apex:pageBlockSection>
<apex:pageBlockTable value="{!books}" var="b">
<apex:column width = "25px">
<apex:inputCheckbox value="{!b.checked}" />
</apex:column>
<apex:column value="{!b.b1.Name}"/>
<apex:column value="{!b.b1.Price__c}"/>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:form>
</apex:page>
---------------------------------------------------class--------------------------------------------------
public class testWrapper
{
public List<Wrapper> books{get; set;}
public testWrapper()
{
books = new List<Wrapper>();
for(Book__c b1 : [select name,Price__c from Book__c])
{
books.add(new wrapper(b1));
}
}
public class Wrapper
{
public boolean checked {get; set;}
public Book__c bl {get; set;}
public Wrapper(Book__c bl)
{
this.bl = bl;
this.checked = false;
}
}
}
- geetha b 8
- November 03, 2014
- Like
- 0
- Continue reading or reply
Please resolve my problem in wrapper class
Here is mu code
<apex:page controller="testWrapper">
<!-- Using wrapper class -->
<apex:form>
<apex:pageBlockSection>
<apex:pageBlockTable value="{!books}" var="b">
<apex:column width = "25px">
<apex:inputCheckbox value="{!b.checked}" />
</apex:column>
<apex:column value="{!b.b1.Name}"/>
<apex:column value="{!b.b1.Price__c}"/>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:form>
</apex:page>
---------------------------------------------------class--------------------------------------------------
public class testWrapper
{
public List<Wrapper> books{get; set;}
public testWrapper()
{
books = new List<Wrapper>();
for(Book__c b1 : [select name,Price__c from Book__c])
{
books.add(new wrapper(b1));
}
}
public class Wrapper
{
public boolean checked {get; set;}
public Book__c bl {get; set;}
public Wrapper(Book__c bl)
{
this.bl = bl;
this.checked = false;
}
}
}
<apex:page controller="testWrapper">
<!-- Using wrapper class -->
<apex:form>
<apex:pageBlockSection>
<apex:pageBlockTable value="{!books}" var="b">
<apex:column width = "25px">
<apex:inputCheckbox value="{!b.checked}" />
</apex:column>
<apex:column value="{!b.b1.Name}"/>
<apex:column value="{!b.b1.Price__c}"/>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:form>
</apex:page>
---------------------------------------------------class--------------------------------------------------
public class testWrapper
{
public List<Wrapper> books{get; set;}
public testWrapper()
{
books = new List<Wrapper>();
for(Book__c b1 : [select name,Price__c from Book__c])
{
books.add(new wrapper(b1));
}
}
public class Wrapper
{
public boolean checked {get; set;}
public Book__c bl {get; set;}
public Wrapper(Book__c bl)
{
this.bl = bl;
this.checked = false;
}
}
}
- geetha b 8
- November 03, 2014
- Like
- 0
- Continue reading or reply