How to set the Dataframe extent in the page layout view ?

Discussion created by Shrey on May 13, 2012
Latest reply on Aug 6, 2013 by geoheinz
Hi All,

    In my page layout view I have to separate data frame both showing some data. When ever I am trying to set the extent of the data frame it is not setting as desired.
For example  I have to polygon feature in the above data frame I want to show the extent of the 1st  polygon feature extent and in the next data frame I want to show the extent of the next selected feature- polygon, but that data frame is always showing some random extent .I am not getting how to solve this.Below is the code which I am u sing for  the same.

Code :
  public static void RotateDataframe(double angle, IFeature pFeature, int currentmap)

            IDisplayTransformation pDispTrans = null;
            IActiveView pActiveview = null;
            IEnvelope pEnvele = new EnvelopeClass();
            IPageLayout pLayout = null;
            IGraphicsContainer pGraphicsContainer = null;
            IMapFrame pMapFrame = null;
            IEnvelope pEnv = null;
            IEnvelope overLappingExtent = null;

                pActiveview = pMxDocument.ActiveView.FocusMap as IActiveView;

                pDispTrans= pActiveview.ScreenDisplay.DisplayTransformation as IDisplayTransformation;

                pDispTrans.Rotation = angle;
               pActiveview.Extent = pFeature.Extent;

            catch (Exception ex)

                throw ex;