[SalesForce] How to make the check box true even if it is not ticked in visual force page

How to make the check box true even if it is not ticked in visual force page, I mean the picture with tick mark.

but its not working, is ther any other way

Edit:

<apex:page controller="controller">
<apex:form>
    <apex:pageBlock>
        <apex:pageBlockButtons>
            <apex:commandButton value="New " /></apex:pageBlockButtons>
        <apex:pageBlockTable value="{!Records}" var="R">
            <apex:column headerValue=" Name" value="{!R.name}" />
            <apex:column headerValue="City" value="{!R.City__c}" />
            <apex:column headerValue="Country" value="{!R.Country__c }" />
            <apex:column headerValue="CheckBox" value="{!R.checkbox__c}" />
       </apex:pageBlockTable>...

and

[class: public with sharing class controller {
      public list < Bank__c > objB = [select id, name, city__c, country__c, CheckBox__c from Bank__c];
       public list < bank__c > getRecords() {
           return objB;
       }
}]

Best Answer

The path to the pictures is

/img/checkbox_checked.gif
/img/checkbox_unchecked.gif

So you can easily use them in

...
<apex:column headerValue="CheckBox">
    <img src="/img/checkbox_checked.gif" />
    <!-- or maybe <apex:image value="/img/checkbox_{!IF(someCondition,'checked', 'unchecked')}.gif" /> -->
</apex:column>
...

You'll have trouble whenever Salesforce decides to move/rename them though. There are several similar questions here already (like Is there a list of Salesforce images that can be used in custom pages and formula fields?) that recommend downloading them, packing them up in your own static resource etc.

So "Safe Harbor" and good luck :)


EDIT: I think what you need is to tick all the checkboxes server-side? Something like this then:

public with sharing class controller {
    public list < Bank__c > objB = [select id, name, city__c, country__c, CheckBox__c from Bank__c];
    public list < bank__c > getRecords() {
        if(objB != null){
            for(Bank__c bank : objB){
                bank.CheckBox__c = true;
            }
        }
        return objB;
    }
}
Related Topic