how to make Checkbox ReadOnly in Web application
<p>I have a gridview with a checkbox in every row. When put into Edit mode the Checkbox can be checked/unchecked; but I don't want the checkbox to be editable in any other mode. The user easily might get confused by checked boxes that do not reflect the real values saved back in the database.</p>

<pre><code>&lt;asp:CheckBox id="checkboxCustomerRequired" runat="server" Checked='&lt;%# Bind("CustomerRequired") %&gt;' Enabled="false" CssClass="Check"/&gt;
</code></pre>

<p>Possible workarounds I tried:<br>
1) Setting enabled = false </p>
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;</p>2) Using OnCheckedChange Event</p>The idea is to set it's state back once it had been changed. The problem is that I'm moving within a gridview and I can't figure out how to establish the row in which the Checkbox Click had occurred. This doesn't seem to be possible in the given situation.</p>Any suggestions?
Martin</p>