I am trying to force two text boxes to be read only if a checkbox is false, and when the checkbox is true, make the text boxes be editable. I am pulling my hair out. Both text boxes are bound, as is the checkbox triggering them. If I modify the extended properties, it seems to disable being able to toggle them read only via the checked change event on the Checkbox. If I changed the IsEpiReadOnly property on them, it almost seems to work in reverse of the logic I would expect. But even then, it doesn’t set the read only when the form loads based on the current value as the form is loaded.
private void chkDynamicPrefix_CheckedChanged(object sender, System.EventArgs args)
{
if (Convert.ToBoolean(edvPart.dataView[edvPart.Row]["DynamicSNPrefix_c"]) == true)
{
txtPrefixAbbr.IsEpiReadOnly = true;
txtDateCode.IsEpiReadOnly = true;
}
else
{
txtPrefixAbbr.IsEpiReadOnly = false;
txtDateCode.IsEpiReadOnly = false;
}
}
If it matters, I am working in the SN Prefix screen. My goal is to add the ability to make a date code in the SN Prefix field for a numeric serial number that auto updates itself with each week. Masking does not suit us because it will not let us enter a range of serial numbers.