Home > SharePoint, SharePoint 2010, SharePoint 2013 > SharePoint List – Display Field Only On View Mode

SharePoint List – Display Field Only On View Mode

Use the below snippet for creating fields that gets displayed only on View screen.

	string newField = "<Field Type=\"Text\" MaxLength=\"50\" DisplayName=\"NewField\" Name=\"NewField\" ShowInNewForm=\"FALSE\" ShowInEditForm=\"FALSE\" />";
	list.Fields.AddFieldAsXml(newField, true, SPAddFieldOptions.Default);
Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: