You say 'preview', do you mean an unpublished page?
If you get your custom pages data using the generated code you 'll need to implement your own extension to get unpublished pages using something like:
CMS.DocumentEngine.DocumentHelper.GetDocuments<YourCustomType>();
instead of:
CMS.DocumentEngine.DocumentHelper.GetDocuments<YourCustomType>().PublishedVersion().Published();