在我的一个基于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