在我的一個基於ASP.Net和Sitecore CMS的頁面中,我使用CheckBoxList控件,但不知何故它不會在HTML中輸出標籤。CheckBoxList不輸出標籤
<asp:CheckBoxList runat="server" ID="chkListBrochure" CssClass="checkbox_single" />
在代碼隱藏文件我加載列表:
foreach (var item in itemList)
{
var newListItem = new ListItem(item.Title, item.Code);
newListItem.Selected = item.Selected;
chkListBrochure.Items.Add(newListItem);
}
當我查看它顯示爲
<div id="body_0_content_0_content_1_chkListBrochure" class="checkbox_single">
<input id="body_0_content_0_content_1_chkListBrochure_0" class="" type="checkbox"
name="body_0$content_0$content_1$chkListBrochure$0">
<input id="body_0_content_0_content_1_chkListBrochure_1" class="" type="checkbox"
checked="checked" name="body_0$content_0$content_1$chkListBrochure$1">
<input id="body_0_content_0_content_1_chkListBrochure_2" class="" type="checkbox"
name="body_0$content_0$content_1$chkListBrochure$2">
<input id="body_0_content_0_content_1_chkListBrochure_3" class="" type="checkbox"
checked="checked" name="body_0$content_0$content_1$chkListBrochure$3">
<input id="body_0_content_0_content_1_chkListBrochure_4" class="" type="checkbox"
name="body_0$content_0$content_1$chkListBrochure$4">
<input id="body_0_content_0_content_1_chkListBrochure_5" class="" type="checkbox"
checked="checked" name="body_0$content_0$content_1$chkListBrochure$5">
</div>
,如果我複製此代碼工作正常,在瀏覽器的代碼在基於非Sitecore的項目中。有沒有人遇到過這個問題?任何建議?
感謝
納斯
我認爲我們需要更多信息。 Var數據類型是itemList,什麼是item.Selected和item.Code?他們是爲了獲取字段值而做出的擴展方法嗎? Item.Id是否工作 – Holger