2013-06-10 2 views
0

그래서 웹 파트 활성화시 프로그래밍 방식으로 서로 연결된 두 개의 목록을 만들려고합니다.SP 2010에서 프로그래밍 방식으로 목록에 드롭 다운 및 멀티 선택 목록 추가

public override void FeatureActivated(SPFeatureReceiverProperties properties) 
    { 
     SPWeb spWeb = properties.Feature.Parent as SPWeb; 
     if (spWeb != null) 
     { 
      // Create our Lists 
      spWeb.Lists.Add("Memeber Records", "Holds a list of Memebers", SPListTemplateType.GenericList); 
      spWeb.Lists.Add("Certification", "Certifications and Their Descriptions", SPListTemplateType.GenericList); 

      SPList list = spWeb.Lists["Memeber Records"]; 
      SPList certList = spWeb.Lists["Certification"]; 

      // Add Outr Fields 
      list.Fields.Add("Memebr ID", SPFieldType.Integer, true); 
      list.Fields.Add("Memeber Name", SPFieldType.Text, true); 
      // were missing a item - a drop down with static content such as: Association, Company, Head Office 
      list.Fields.Add("Memeber Certification", SPFieldType.Lookup, false); 

      list.Update(); 

      certList.Fields.Add("Certfication Title", SPFieldType.Text, true); 
      certList.Fields.Add("Description", SPFieldType.Text, true); // This one should be a text box allowing 256 characters 

      certList.Update(); 
     } 
    } 

당신은 내가 몇 가지 더를 만드는 방법을 알아 내기 위해 당신의 도움을 필요로하고 볼 수 있듯이 :

  • 나는 필드로 그 안에 정적 콘텐츠와 드롭 다운이 필요합니다. 그러나 .Fields.Add()에는 드롭 다운 기능이 없습니다. list
  • certList 두 번째 필드는 최대 250 개의 문자가있는 텍스트 상자로 가정합니다.
  • 가 어떻게 certListlist에 연결 할 같은 certtList

에서이 끌어 회원 인증을 선택할 때 나는이 웹 파트의 활성화에 따라이 작품을 가지고 실종 뭔가가 있다고? 나는 사이트로 범위 만 배포 할 때 (I 프로젝트를 만들 때, 나는 선택)의 농장 대신 샌드 박스

답변

0

당신이 선택 필드를 사용하여 노력했다. list.Fields.Add에는 선택 항목을 채울 수있는 오버로드가 있습니다. 나는 그것을 시도하지는 않았지만, 이것은 특히 선택 분야를위한 것입니다.