You need to sign in to do that
Don't have an account?
Padmanabhan Kamuni
how extract List values in Set Collection & display SET elements in VF page
Controller class.
public class SetVFPage {
public Set<Group__c>acc { get; set; }
public string keyword{get;set;}
List<Group__c > accList{get;set;}
Set<Group__c > accSET = new Set<Group__c >();
public pagereference Search(){
accList =[SELECT Name, id,Course_Name__c FROM Group__c where Name Like: '%'+keyword+'%'];
for(Group_c gp : accList){
gp.name;
}
return null;
}
}
VF Page
<apex:page controller="SetVFPage ">
<apex:form >
<apex:pageBlock >
<!--<apex:inputField value="{!keyword}"/>-->
<apex:commandButton value="Search" action="{!Search}" />
<apex:pageBlockTable value="{!acc}" var="s">
<apex:column value="{!s.name}"/>
<apex:column value="{!s.Course_Name__c} "/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
Error: Task08 Compile Error: Invalid type: Group_c at line 12 column 12
Request your comments for solution.
Thanks
public class SetVFPage {
public Set<Group__c>acc { get; set; }
public string keyword{get;set;}
List<Group__c > accList{get;set;}
Set<Group__c > accSET = new Set<Group__c >();
public pagereference Search(){
accList =[SELECT Name, id,Course_Name__c FROM Group__c where Name Like: '%'+keyword+'%'];
for(Group_c gp : accList){
gp.name;
}
return null;
}
}
VF Page
<apex:page controller="SetVFPage ">
<apex:form >
<apex:pageBlock >
<!--<apex:inputField value="{!keyword}"/>-->
<apex:commandButton value="Search" action="{!Search}" />
<apex:pageBlockTable value="{!acc}" var="s">
<apex:column value="{!s.name}"/>
<apex:column value="{!s.Course_Name__c} "/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
Error: Task08 Compile Error: Invalid type: Group_c at line 12 column 12
Request your comments for solution.
Thanks
There are some mistake in your code i have fixed those mistake now it is searching the records from object Group__c
please refer the following Code.
Controller: Visualforce Page:
Regards,
Suraj
All Answers
Syntax error. It's Group__c and not Group_c.
There are some mistake in your code i have fixed those mistake now it is searching the records from object Group__c
please refer the following Code.
Controller: Visualforce Page:
Regards,
Suraj
please check code below: If this code will help you then,
choose it as a best answer.
thanks:
Satish Kumar Prajapat.
Suraj Tripathi code is printing the duplicate record. becase its never using Set data on VF page.
please check it.
Thanks.
the modified version as below
Anyways thanks for updating me.