function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ganeshjujjuruganeshjujjuru 

what is data binding in salesforce ..?

Can any body help me what is data binding , what are the types of data binding ,where we use data binding...? give me examples.

bob_buzzardbob_buzzard

I'm not sure exactly in which context you are referring to data binding, but from the Visualforce perspective it means binding a property from the controller to an input on the page.

 

So if you have a controller that is managing a contact:

 

public class MyController
{
  public Contact myContact {get; set;}

  public MyController()
  {
    myContact=new Contact();
  }
}

You can then bind inputs on the page to the contact instance in the controller:

<apex:page controller="MyController">
  <apex:form>
     <apex:inputField value="{!Contact.FirstName}" />
  </apex:form>
</apex:page>

In the snippet above, the '{!Contact.FirstName}' binds the FirstName field of the Contact property to the input - anything the user enters here will be automatically written to the Contact.FirstName field when the form is submitted.