Field may be hidden due to field level security or might be that it doesn’t contain any value. If this is the problem, then write following apex code:
/*showing whether contact.FirstName contains a value*/
public class DemoController {
public Contact contact;
public DemoController () {
contact = [Select Name from Contact][0];
System.assert(false, contact.Name);
}
}
/*If the field was hidden due to field level security and FirstName contains a value ‘Sandeep’ then it will display on page as*/
System.AssertException: Assertion Failed: Sandeep