Monday, September 21, 2009

Seperate DisplayMode Controls from EditMode Controls in a SharePoint field control

Scenario:
Its not very uncommon to have a field control separate display mode controls from edit mode controls. The approach I follow is to seperate them in CreateChildcontrols()

Code:
if (this.ControlMode == SPControlMode.Edit || this.ControlMode == SPControlMode.New)
{
//CreateEditModeControls();
//Code for adding Edit Mode Controls here
}
else
{
//CreateDisplayModeControls();
//Code for adding Display Mode Controls here
}

No comments:

Post a Comment