0
webpart에 체크 박스 목록을 추가하려고합니다. 편집 모드에는 목록의 필드 이름을 포함하는 드롭 다운 목록이 있으며 선택된 필드는 웹 파트의 checkboxlist 항목에 대한 표시로 사용됩니다.드롭 다운 목록 사용하기 webpart (편집 모드)
이 작업을 수행하는 방법에 대한 예제를 찾을 수 없습니다.
webpart에 체크 박스 목록을 추가하려고합니다. 편집 모드에는 목록의 필드 이름을 포함하는 드롭 다운 목록이 있으며 선택된 필드는 웹 파트의 checkboxlist 항목에 대한 표시로 사용됩니다.드롭 다운 목록 사용하기 webpart (편집 모드)
이 작업을 수행하는 방법에 대한 예제를 찾을 수 없습니다.
같은 당신의 드롭 다운 속성을 만들 수있는 사용자 정의 ToolPart
를 사용
public class DropdownToolPart : ToolPart
{
protected override void CreateChildControls()
{
DropDownList dropdownList = new DropDownList();
// Code to add field names from SharePoint List to dropdownlist
this.Controls.Add(dropdownList);
base.CreateChildControls();
}
public override void ApplyChanges()
{
CheckBoxListWebPart myWebPart =
(CheckBoxListWebPart)this.ParentToolPane.SelectedWebPart;
//You will need to get the selected value of the dropdown by finding it
//in the Controls collection.
string selectedValue = ...
myWebPart.CheckBoxListDisplayField = selectedValue;
}
}
귀하는 WebPart를 포함하는 다음을 수행해야 ToolPart
:
public class CheckBoxListWebPart: WebPart
{
public string CheckBoxListDisplayField { get; set; }
public override ToolPart[] GetToolParts()
{
ToolPart[] toolParts = new ToolPart[1];
DropdownToolPart myToolPart = new ToolPart();
toolParts[0] = myToolPart;
return toolParts;
}
}
거기에서 만들 수있을 것입니다 당신의 체크 박스 목록은 CreateChildControls
방법은 CheckBoxListWebPart
입니다. 여기에서 SharePoint 목록의 항목을로드 한 다음 CheckBoxListDisplayField
값을 사용하여 각 항목의 정확한 필드 값을 선택해야합니다.
입력 해 주셔서 감사합니다 .. ApplyChanges에서 webpart에는 컨트롤이없고 모든 속성이 null입니다. 어떻게 해결할 수 있습니까? – Birger