日期:2014-05-17  浏览次数:20408 次

CheckboxList添加Value属性
CheckboxList添加Value属性.

公司框架的取值结构是:

C# code

<asp:CheckBoxList ID="checkList_Emp_Other" runat="server" RepeatDirection="Horizontal">
<asp:ListItem Value="0" alt="0">厂服</asp:ListItem>
<asp:ListItem Value="1" alt="1">门卡</asp:ListItem>
</asp:CheckBoxList>


alt:后面跟的是value的值.
生成的HTML:
HTML code

<table id="checkList_Emp_LabourGoods" border="0">
    <tr>
        <td><span alt="0"><input id="checkList_Emp_LabourGoods_0" type="checkbox" name="checkList_Emp_LabourGoods$0" /><label for="checkList_Emp_LabourGoods_0">厂服</label></span></td><td><span alt="1"><input id="checkList_Emp_LabourGoods_1" type="checkbox" name="checkList_Emp_LabourGoods$1" /><label for="checkList_Emp_LabourGoods_1">门卡</label></span></td>
    </tr>
</table>



现在我需要做动态绑定.生成出的html是没有value值的.也没有上面的span标签.
如何才能动态绑定后让其结构和以上HTML一致.求解..



------解决方案--------------------
C# code
        <asp:CheckBoxList ID="checkList_Emp_Other" runat="server" RepeatDirection="Horizontal">
            <asp:ListItem Value="0" alt="0">厂服</asp:ListItem>
            <asp:ListItem Value="1" alt="1">门卡</asp:ListItem>
        </asp:CheckBoxList>