We take pride in your success. We let our positivity drive us, day in and out. Talk to us at Mindfire to know us more.

Software Technology Tips

Choice fields are often used within SharePoint lists to display choice options like Gender, Status, etc and these choice options can be displayed using Radio Button and Dropdown formats.
 
Provided below is a code sample in C#.Net which describes the creation of a choice field programmatically using SharePoint API.
 
/* get the newly added choice field instance */
SPFieldChoice chFldGender = (SPFieldChoice)lst.Fields["Gender"];
 
/* set field format type i.e. radio / dropdown */
chFldGender.EditFormat = SPChoiceFormatType.Dropdown;
 
/* set the choice strings and update the field */
chFldGender.Choices.Add("Male");
chFldGender.Choices.Add("Female");
chFldGender.Update();
 
/* finally update list */
lst.Update();


Related Tags:

Sharepoint, C#

Author: Kaushik Mohanty

top

Related Pages

  • SharePoint Development India
  • SharePoint Application Projects

SharePoint

Let us Connect!

privacy

copyright (c) Mindfire Solutions 2007-2012. Login