문제

I'm developing a Sharepoint 2007 application with Visual Studio 2008 / C#.

I have a FeatureReceiver to build lists programatically on feature activation. That all works fine.

Normal Mutichoice field can be added this way:

myList.Fields.Add(title, type, required, false, choices);

My question is: How can I add a Multichoice field as checkboxes to my list?

Thanks

도움이 되었습니까?

해결책

You need to use SPFieldType.MultiChoice for 2nd parameter...

다른 팁

Using SPFieldType.MultiChoice field type gives you check boxes in the UI.

However, if you ever need a choice field with radio buttons, the choice field class SPFieldChoice has a property EditFormat that allows to specify one of the two options for how to display selections:

  • SPChoiceFormatType.Dropdown - drop-down list box
  • SPChoiceFormatType.RadioButtons - option buttons
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top