The field is defined as follow:
Name="AgeOptions"
DisplayName="Age Options"
RichText="TRUE"
RichTextMode="FullHtml"
Required="FALSE"
Group="SIA Enquiry Form"
ID="{119EFAFF-63D3-4d61-A393-06DE18A91093}"
SourceID="http://schemas.microsoft.com/sharepoint/v3">
I used the following code to access the field from the code behind of my page layout:
SPField field = SPContext.Current.Fields["Age Options"];
if (field != null)
{
Response.Write("Found the Age options field: " + field.InternalName + " Type: " + field.TypeAsString);
SPFieldChoice ageOptions = (SPFieldChoice) field;
StringCollection choices = ageOptions.Choices;
for (int i = 0; i < choices.Count; i++)
Response.Write("Choice ->> " + choices[i] + "
");
}
else
Response.Write("Age options not found.");
No comments:
Post a Comment