4. January 2010 09:27
Sometimes you simply need to dump out the contents of a text field raw, and not have the SharePoint field controls alter you HTML, strip scripts, etc.
I’m currently using this to display raw HTML that is being programmatically imported into a list.
This is a very simple example of how to make a field control, however you’ll want to ensure you consider things like caching and security before deploying this.
public class RawTextFieldControl : BaseFieldControl
{
public XnaRawTextFieldControl()
{
base.DisableInputFieldLabel = true;
base.ControlMode = SPControlMode.Display;
}
protected override void RenderFieldForDisplay(HtmlTextWriter output)
{
output.Write(this.ItemFieldValue);
}
}