Sodium chloride has a giant ionic lattice. This is formed due to the ionic bonding, which involves the transfer of electrons from one atom to another to ensure each atom has a full outer shell of electrons. Sodium will lose an electron to become Na+ whilst chloride will gain an electron to form Cl-. These charged atoms are called ions. The strong forces or attraction between the two oppositely charged ions will hold them close together, forming the ionic bond. These electrostatic forces of attraction act in all directions which holds the ions in a giant ionic lattice.
A lot of energy is require to overcome the strong electrostatic forces of attraction, giving the molecules a high melting and boiling point (meaning they are solid). Ionic lattices are soluble in water, and when soluble or molten the free charged ions are able to carry electric charge.