Could someone please tell me when to use DisplayFor, PropertyFor, EditAttribute also which one is best to use?
also, what is the difference between them?
The DisplayFor helper renders the corresponding display template for the given type.
For PropertyFor Vs EditAttribute please check the following thread
DisplayFor is the .NET standard way. It will render your property alright but it won't have any on-page editing. You can create your own display templates for different property types if you wish just like for a normal .NET MVC project. Not commonly used for Episerver properties because of the limitations to editor support.
PropertyFor is the recommended Episerver way of rendering a property. It's a DisplayFor with superpowers basically. You should use this one to get editor support for your properties with the minimal amount of code.
Edit Attribute can be helpful sometimes if you want editor support for your property but the PropertyFor doesn't render the thing with the exact html you want. So use this one instead of PropertyFor if you want detailed control of the rendering and still need editor support.