I have a list A with field SAP (radiobutton datatype). It has 3 values SAP-FSL, SAP NXP and both. I need to display these 3 values in webpart as radiobutton provided in image. It will be dynamic, in future if we want to add new radio control in webpart we just want to add new value in fields SAP. How to achieve this. Please help with c#. Thanks.

Asked
Active
Viewed 38 times
0
Brishal
- 1,205
- 11
- 42
- 59
1 Answers
0
SPFieldChoice field = (SPFieldChoice)spList.Fields[fieldName];
List<string> fieldList = new List<string>();
foreach (string str in field.Choices)
{
fieldList.Add(str);
}
where spList is SPList object.
fieldList contains the choice fields value. Using these values, you can bind your radio-button list.
Divya Sharma
- 1,461
- 11
- 26
field.Choices.map(=>str)instead of that foreach loop? – Danny '365CSI' Engelman Apr 27 '17 at 10:14map, found it in MSDN: https://msdn.microsoft.com/en-us/library/bb548891.aspx – Danny '365CSI' Engelman Apr 27 '17 at 11:01map. – Divya Sharma Apr 27 '17 at 11:15