SPContext.IsPopUI property
SharePoint 2013
Gets a value that indicates whether the current request is for a page that represents a pop-up dialog in the user interface (UI).
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)