Skip to main content
abc def が「#Visualforce」で質問
Hi All,

i am working on a project where i have a field in my model called count 

in my visualforce page if user clicks on a command link then that count must go a set in my model 

I have to get the total number of counts in the model 

can any one help with this (simple code)

thank u in advs 

 
3 件の回答
  1. 2018年10月13日 5:59
    Hi Divya,

    Try this code:

    Vf page:

    <apex:page controller="Buttonclick_controller">

        <apex:form> 

            <apex:pageBlock>

                <apex:commandButton value="click" action="{!countclick}"/> <br/>

                      Number of clicks= {!countvalue}

            </apex:pageBlock>

        </apex:form> 

    </apex:page>

    Controller class:

    public class Buttonclick_controller {

    public Integer count{get;set;}

    public Integer countvalue{get;set;}

    public Buttonclick_controller()

    {

        count=1;

    }

    public void countclick()

    {

       countvalue=count++; 

    }

    }

    Hope this code will help you.Mark it as best answer so that others get help from this too.

    Thanks.

    Ajay Dubedi
0/9000