我使用ASP CheckBoxList的RepeatColumns在一个类型列表中创建三列。这通常可以正常工作,但偶尔会在页面加载列时崩溃。这似乎是在所有浏览器中随机发生的。我确实使用OutputCache。
之前有没有人注意到这种行为?
这是代码的片段:
<table width="100%"><tr><td width="66%" style="padding-left:4px">Genres:</br>
<asp:CheckBoxList RepeatColumns="3" CssClass="chkChoice" ID="CheckBoxList_Genres" runat="server">
<asp:ListItem Selected="True">Action</asp:ListItem>
<asp:ListItem Selected="True">Comedy</asp:ListItem>
<asp:ListItem Selected="True">Classics</asp:ListItem>
<asp:ListItem Selected="True">Documentary</asp:ListItem>
<asp:ListItem Selected="True">Drama</asp:ListItem>
<asp:ListItem Selected="True">Fantasy</asp:ListItem>
<asp:ListItem Selected="True">Foreign</asp:ListItem>
<asp:ListItem Selected="True">Independent</asp:ListItem>
<asp:ListItem Selected="True">Kids</asp:ListItem>
</asp:CheckBoxList>
</td>
在回复评论时,这是渲染的html:
<span id="ctl00_ContentPlaceHolder1_CheckBoxList_Genres" class="chkChoice"><input id="ctl00_ContentPlaceHolder1_CheckBoxList_Genres_0" type="checkbox" name="ctl00$ContentPlaceHolder1$CheckBoxList_Genres$0" checked="checked" /><label for="ctl00_ContentPlaceHolder1_CheckBoxList_Genres_0">Action</label><input id="ctl00_ContentPlaceHolder1_CheckBoxList_Genres_3" type="checkbox" name="ctl00$ContentPlaceHolder1$CheckBoxList_Genres$3" checked="checked" /><label for="ctl00_ContentPlaceHolder1_CheckBoxList_Genres_3">Documentary</label><input id="ctl00_ContentPlaceHolder1_CheckBoxList_Genres_6" type="checkbox" name="ctl00$ContentPlaceHolder1$CheckBoxList_Genres$6" checked="checked" /><label for="ctl00_ContentPlaceHolder1_CheckBoxList_Genres_6">Foreign</label><br /><input id="ctl00_ContentPlaceHolder1_CheckBoxList_Genres_1" type="checkbox" name="ctl00$ContentPlaceHolder1$CheckBoxList_Genres$1" checked="checked" /><label for="ctl00_ContentPlaceHolder1_CheckBoxList_Genres_1">Comedy</label><input id="ctl00_ContentPlaceHolder1_CheckBoxList_Genres_4" type="checkbox" name="ctl00$ContentPlaceHolder1$CheckBoxList_Genres$4" checked="checked" /><label for="ctl00_ContentPlaceHolder1_CheckBoxList_Genres_4">Drama</label><input id="ctl00_ContentPlaceHolder1_CheckBoxList_Genres_7" type="checkbox" name="ctl00$ContentPlaceHolder1$CheckBoxList_Genres$7" checked="checked" /><label for="ctl00_ContentPlaceHolder1_CheckBoxList_Genres_7">Independent</label><br /><input id="ctl00_ContentPlaceHolder1_CheckBoxList_Genres_2" type="checkbox" name="ctl00$ContentPlaceHolder1$CheckBoxList_Genres$2" checked="checked" /><label for="ctl00_ContentPlaceHolder1_CheckBoxList_Genres_2">Classics</label><input id="ctl00_ContentPlaceHolder1_CheckBoxList_Genres_5" type="checkbox" name="ctl00$ContentPlaceHolder1$CheckBoxList_Genres$5" checked="checked" /><label for="ctl00_ContentPlaceHolder1_CheckBoxList_Genres_5">Fantasy</label><input id="ctl00_ContentPlaceHolder1_CheckBoxList_Genres_8" type="checkbox" name="ctl00$ContentPlaceHolder1$CheckBoxList_Genres$8" checked="checked" /><label for="ctl00_ContentPlaceHolder1_CheckBoxList_Genres_8">Kids</label></span>
答案 0 :(得分:0)
如果您不介意将复选框列表制表,请添加RepeatLayout="Table"
。
E.g。
<asp:CheckBoxList RepeatColumns="3" CssClass="chkChoice"
ID="CheckBoxList_Genres" runat="server"
RepeatLayout="Table" >....