So I am working on cross-browser code right now. I have checkboxes, that disable after certain functions are called, in IE but not in Firefox & Chrome.
I looked into the code and I see that when rendered in Firefox, the disabled tag is placed on the td which is why it works in IE and not the other browsers.
Is there a way in asp.net to disable the cell or checkbox and have it render properly in Firefox, Chrome, etc?
Here is my function where enabled = false
protected void FilterCheckBox(object sender, ASPxGridViewTableCommandCellEventArgs e)
{
if (ExecContractGridView != null)
{
try
{
if (ExecContractGridView.GetRowValues(e.VisibleIndex, "UnionExecutedBy") != null)
{
if (!string.IsNullOrEmpty(ExecContractGridView.GetRowValues(e.VisibleIndex, "UnionExecutedBy").ToString()))
{
e.Cell.Enabled = false;
}
}
}
catch (Exception ex)
{
ApplicationLog.Exception(this, ex);
}
}
}
To do this properly you want to find the checkbox control and set
disabled = "disabled".You can do so on the client side using JavaScript or a library like jQuery. Or, in your code above, once you have
e.Cellyou can locate theCheckBoxcontrol and set it toEnabled = false.To further clarify,
e.Cellcontains aCheckBoxcontrol as one of its child controls. So you could do: