We suggest in which situation you can use action support tag and what it is ActionSupport.
This is one of the AJAX support components in the visualforce page. Based on the event it will call apex class method and partially refresh the page. This is a good feature in the actionsupport tag.
Syntax :-
<apex:actionSupport event=”event-name” action=”{!apex-method-name}”/>
For example,
Here we mentioned, when ever you change the text in textbox
Visualforce Page Code :-
<apex:page controller=”ActionSupportHandler” sidebar=”false”>
<apex:form >
<apex:pageBlock title=”Input Block”>
<apex:inputText value=”{!txtval}”>
<apex:actionSupport event=”onkeyup” action=”{!selval}” reRender=”tbl”/>
</apex:inputText></apex:pageBlock>
</apex:pageBlock>
<apex:pageBlock title=”Related Student Records”>
<apex:pageBlockTable id=”tbl” value=”{!selList}” var=”aa”>
<apex:column value=”{!aa.id}”/>
<apex:column value=”{!aa.name}”/>
<apex:column value=”{!aa.Marks__c}”/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
Apex Code :-
public class ActionSupportHandler{
public List<Student__c> selList{set;get;}
public String txtval{set;get;}
public void selval(){
system.debug(txtval);
selList=[select id,name,Marks__c from Student__c where name like :’%’+txtval+’%’];
system.debug(selList);
}
}
Result –
We are the ISV Partners and Please reach us for custom development => www.merfantz.com
————————– We hope this will help you —————————