Hide Objects Inside a Detail

I’m trying to write a c# code to hide the preview of some objects in a detail inside the layout, they should be displayed anywhere outside the mentioned detail.
could anyone help me with the methods that can help me deal with the problem?
To be specific I’m looking for something like Command: HideInDetail in rhino.