Showing posts with label page modes. Show all posts
Showing posts with label page modes. Show all posts

Tuesday, August 4, 2009

How do you tell current sharepoint page is in edit/display/other modes?

Microsoft.SharePoint.WebControls.SPControlMode enumeration contains following values:
  • Display
  • Edit
  • Invalid
  • New

With following condition, you can check in which mode you are in:


if (SPContext.Current.FormContext.FormMode == Microsoft.SharePoint.WebControls.SPControlMode.Display)


{
// you are in display mode
}