Skip to main content

72

·48 words·1 min

I just came across a nice addition to my base web part:

if (Microsoft.SharePoint.SPContext.Current.FormContext.FormMode == SPControlMode.Display)
{
  // your code to support display mode
}
else // Microsoft.SharePoint.SPContext.Current.FormContext.FormMode = SPControlMode.Edit
{
  // your code to support edit mode
}

Since it isn’t mine, credits go to this post.