我有一个网格视图,每一行都有一个复选框。当进入编辑模式时,可以选中/取消选中复选框;但我不希望该复选框在任何其他模式下都是可编辑的。用户可能很容易对不反映保存回数据库中的真实值的复选框感到困惑。
<asp:CheckBox id="checkboxCustomerRequired" runat="server" Checked='<%# Bind("CustomerRequired") %>' Enabled="false" CssClass="Check"/>
我尝试过的可能的解决方法:
1) 设置启用 = false
This achieves the goal, but the greyed out box is ugly and prevents from capturing it's state in one glance. Therefore I tried to set the forecolor of the box in the OnRowDataBound Event back to white, but it doesn't work. Checkbox.ForeColor = System.Drawing.Color.White;
您可以通过返回使复选框只读false
in the onclick
客户端事件:
<asp:CheckBox ID="checkboxCustomerRequired" runat="server" onclick="return false;" ... />
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)