about EditModePanel in Sharepoint 2010

In Sharepoint 2010 the EditModePanel has working differently.

One of my friend asked me about a problem with EditModePanel does not render its content instead of PageDisplayMode property  has  already been set to “Display”.This problems only occurs with visitors.(In real who has not have “EditListItems” priviledges)  When i execute the code that he sent me yeah  he is absolutely right. After a couple of minutes in stunned than i used reflector and compared 2007&2010 Microsoft.Office.Sharepoint.Publishing.dll’s. Gotcha !!

Nice and friendly EditModePanel is not as known as it is.  calculateShouldRender() method has been changed

private void calculateShouldRender()

{

if (!ConsoleUtilities.CheckPermissions(SPBasePermissions.EditListItems))

{

this.shouldRender = false;

}

else

{

SPControlMode contextualFormModeFromPostedForm = ConsoleUtilities.GetContextualFormModeFromPostedForm();

if ((SPControlMode.Display == contextualFormModeFromPostedForm) && (PageDisplayMode.Display == this.PageDisplayMode))

{

this.shouldRender = true;

}

else if ((SPControlMode.Edit == contextualFormModeFromPostedForm) && (PageDisplayMode.Edit == this.PageDisplayMode))

{

this.shouldRender = true;

}

else

{

this.shouldRender = false;

}

}

this.Visible = this.shouldRender;

}

if you dont like this extra security code like me you may make your own EditModePanel.