I have CheckBox that is enabled and disabled from server side, but when User edit it in inspect He can alter data even if it is disabled. Is there way how to prevent it like adding readonly attribute on asp:TextBox?
Here is my CheckBox html sample:
<asp:CheckBox ID="cbTest" runat="server" />
And here is behind code:
cbTest.Enabled = false;
//cbTest.Attributes.Add("onclick", "return false;");
//cbTest.Attributes.Add("onclick", "event.preventDefault();");
I have tried adding onclick atributes, but with no success.
Here is script for preventDefault():
window.onload = function () {
$('.readonly:checkbox').click(function (e) {
e.preventDefault();
});
}
Does anyone have any solution?
Aucun commentaire:
Enregistrer un commentaire