# Checkbox Read Only

**URL:** <https://www.epiusers.help/t/checkbox-read-only/41293>\
**Category:** Epicor ERP 10\
**Created:** [November 8, 2017, 4:36pm UTC](https://www.epiusers.help/t/checkbox-read-only/41293 "2017-11-08T16:36:05Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![NathanielT](https://www.epiusers.help/letter_avatar_proxy/v4/letter/n/da6949/32.png) [@NathanielT](https://www.epiusers.help/u/NathanielT)\
**Post date:** [November 8, 2017, 4:36pm UTC](https://www.epiusers.help/t/checkbox-read-only/41293/1 "2017-11-08T16:36:05Z")

</div>

How do you make a rule that would make a checkbox read only after its been checked. Would this be rule wizard or event? Every time i try and make a rule for it in customization it doesnt work.

---

<div class="post-metadata">

**Author:** ![danbedwards](https://www.epiusers.help/letter_avatar_proxy/v4/letter/d/9f8e36/32.png) [@danbedwards](https://www.epiusers.help/u/danbedwards)\
**Post date:** [November 8, 2017, 4:47pm UTC](https://www.epiusers.help/t/checkbox-read-only/41293/2 "2017-11-08T16:47:02Z")

</div>

Assuming the checkbox is bound to a field you can use a Row Rule. Here is example  
 ![image](https://epiusers.help/uploads/default/original/2X/1/15eaeddb55ac68e9777b847cd3fcce0fe2b2f720.png)

---

<div class="post-metadata">

**Author:** ![NathanielT](https://www.epiusers.help/letter_avatar_proxy/v4/letter/n/da6949/32.png) [@NathanielT](https://www.epiusers.help/u/NathanielT)\
**Post date:** [November 8, 2017, 6:55pm UTC](https://www.epiusers.help/t/checkbox-read-only/41293/3 "2017-11-08T18:55:46Z")

</div>

that is how I did it before, but it wont lock after I check it[2017-11-08\_10-53-59.pdf](https://epiusers.help/uploads/default/original/2X/8/8fc4c81dc83f2139622f2a2b338f15fc65f59db2.pdf) (31.6 KB)

---

<div class="post-metadata">

**Author:** ![danbedwards](https://www.epiusers.help/letter_avatar_proxy/v4/letter/d/9f8e36/32.png) [@danbedwards](https://www.epiusers.help/u/danbedwards)\
**Post date:** [November 8, 2017, 7:02pm UTC](https://www.epiusers.help/t/checkbox-read-only/41293/4 "2017-11-08T19:02:20Z")

</div>

Odd. That definitely looks correct. I assume the checkbox on your screen has the EpiBinding to FirmReleaseAll\_c?

Can you paste the code from the script editor just to see if perhaps something is off?

---

<div class="post-metadata">

**Author:** ![NathanielT](https://www.epiusers.help/letter_avatar_proxy/v4/letter/n/da6949/32.png) [@NathanielT](https://www.epiusers.help/u/NathanielT)\
**Post date:** [November 8, 2017, 7:04pm UTC](https://www.epiusers.help/t/checkbox-read-only/41293/5 "2017-11-08T19:04:01Z")

</div>

yes that is correct

// \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
// Custom code for SalesOrderForm  
// Created: 10/28/2016 9:01:16 AM  
// \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
using System;  
using System.ComponentModel;  
using System.Data;  
using System.Diagnostics;  
using System.Windows.Forms;  
using Erp.Adapters;  
using Erp.UI;  
using Ice.Lib;  
using Ice.Adapters;  
using Ice.Lib.Customization;  
using Ice.Lib.ExtendedProps;  
using Ice.Lib.Framework;  
using Ice.Lib.Searches;  
using Ice.UI.FormFunctions;

public class Script  
{  
// \*\* Wizard Insert Location - Do Not Remove ‘Begin/End Wizard Added Module Level Variables’ Comments! \*\*  
// Begin Wizard Added Module Level Variables \*\*

```
// End Wizard Added Module Level Variables **

// Add Custom Module Level Variables Here **

public void InitializeCustomCode()
{
	// **Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines**
	// Begin Wizard Added Variable Initialization

	// End Wizard Added Variable Initialization

	// Begin Wizard Added Custom Method Calls

```

CreateRowRuleOrderHedFirmReleaseAll\_cEquals\_true();;;  
// End Wizard Added Custom Method Calls

```
	SetExtendedProperties();
}

public void DestroyCustomCode()
{
	// **Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines**
	// Begin Wizard Added Object Disposal

	// Begin Custom Code Disposal

	// End Custom Code Disposal
}

private void SetExtendedProperties()
{
	// Begin Wizard Added EpiDataView Initialization
	EpiDataView edvOrderDtl = ((EpiDataView)(this.oTrans.EpiDataViews["OrderDtl"]));
	EpiDataView edvOrderHed = ((EpiDataView)(this.oTrans.EpiDataViews["OrderHed"]));
	// End Wizard Added EpiDataView Initialization

	// Begin Wizard Added Conditional Block
	if (edvOrderDtl.dataView.Table.Columns.Contains("DocUnitPrice"))
	{
		// Begin Wizard Added ExtendedProperty Settings: edvOrderDtl-DocUnitPrice
		edvOrderDtl.dataView.Table.Columns["DocUnitPrice"].ExtendedProperties["Enabled"] = true;
		edvOrderDtl.dataView.Table.Columns["DocUnitPrice"].ExtendedProperties["Format"] = "999,999.99";
		// End Wizard Added ExtendedProperty Settings: edvOrderDtl-DocUnitPrice
	}
	if (edvOrderHed.dataView.Table.Columns.Contains("OrderType_c"))
	{
		// Begin Wizard Added ExtendedProperty Settings: edvOrderHed-OrderType_c
		edvOrderHed.dataView.Table.Columns["OrderType_c"].ExtendedProperties["Enabled"] = true;
		// End Wizard Added ExtendedProperty Settings: edvOrderHed-OrderType_c
	}
	if (edvOrderDtl.dataView.Table.Columns.Contains("DocListPrice"))
	{
		// Begin Wizard Added ExtendedProperty Settings: edvOrderDtl-DocListPrice
		edvOrderDtl.dataView.Table.Columns["DocListPrice"].ExtendedProperties["Format"] = ">>>.>>9.99";
		// End Wizard Added ExtendedProperty Settings: edvOrderDtl-DocListPrice
	}
	// End Wizard Added Conditional Block
}

private void CreateRowRuleOrderHedFirmReleaseAll_cEquals_true()
{
	// Description: LockFirmReleaseAll
	// ****begin autogenerated code****
	RuleAction disabledOrderHed_FirmReleaseAll_c = RuleAction.AddControlSettings(this.oTrans, "OrderHed.FirmReleaseAll_c", SettingStyle.Disabled);
	RuleAction[] ruleActions = new RuleAction[] {
			disabledOrderHed_FirmReleaseAll_c};
	// Create RowRule and add to the EpiDataView.
	RowRule rrCreateRowRuleOrderHedFirmReleaseAll_cEquals_true = new RowRule("OrderHed.FirmReleaseAll_c", RuleCondition.Equals, true, ruleActions);
	((EpiDataView)(this.oTrans.EpiDataViews["OrderHed"])).AddRowRule(rrCreateRowRuleOrderHedFirmReleaseAll_cEquals_true);
	// ****end autogenerated code****
}

```

}

---

<div class="post-metadata">

**Author:** ![BBussey](https://www.epiusers.help/user_avatar/www.epiusers.help/bbussey/32/1315_2.png) [@BBussey](https://www.epiusers.help/u/BBussey)\
**Post date:** [February 15, 2018, 2:48pm UTC](https://www.epiusers.help/t/checkbox-read-only/41293/6 "2018-02-15T14:48:58Z")

</div>

I’m running into similar issues. Checkbox control not recognized by a rule setting. Also can’t affect it with ExtendedProperties on the dataview column or changing an unbound checkbox control. Very annoying.

---

<div class="post-metadata">

**Author:** ![jkane](https://www.epiusers.help/user_avatar/www.epiusers.help/jkane/32/57624_2.png) [@jkane](https://www.epiusers.help/u/jkane)\
**Post date:** [March 12, 2018, 7:47pm UTC](https://www.epiusers.help/t/checkbox-read-only/41293/7 "2018-03-12T19:47:58Z")

</div>

I got it to work on custom fields. Here is the code from the Customization screen.

Oh, and the proper extended property is “Read Only” not “Enabled”. That tripped me up when I was trying to do it too.

```
public void InitializeCustomCode()
	{
		// **Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines**
		// Begin Wizard Added Variable Initialization

		// End Wizard Added Variable Initialization

		// Begin Wizard Added Custom Method Calls

		this.epiCheckBoxC1.CheckStateChanged += new System.EventHandler(this.epiCheckBoxC1_CheckStateChanged);
		this.epiCheckBoxC2.CheckStateChanged += new System.EventHandler(this.epiCheckBoxC2_CheckStateChanged);

		// End Wizard Added Custom Method Calls
	}

	public void DestroyCustomCode()
	{
		// **Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines**
		// Begin Wizard Added Object Disposal

		this.epiCheckBoxC1.CheckStateChanged -= new System.EventHandler(this.epiCheckBoxC1_CheckStateChanged);
		this.epiCheckBoxC2.CheckStateChanged -= new System.EventHandler(this.epiCheckBoxC2_CheckStateChanged);

		// End Wizard Added Object Disposal

		// Begin Custom Code Disposal

		// End Custom Code Disposal
	}

	private void epiCheckBoxC1_CheckStateChanged(object sender, System.EventArgs args)
	{
		if (epiCheckBoxC1.Checked = true)
		{
			//private void SetExtendedProperties()
			{
			// Begin Wizard Added EpiDataView Initialization
				EpiDataView edvPart = ((EpiDataView)(this.oTrans.EpiDataViews["Part"]));
			// End Wizard Added EpiDataView Initialization

			// Begin Wizard Added Conditional Block
				if (edvPart.dataView.Table.Columns.Contains("NPI_c"))
				{
				// Begin Wizard Added ExtendedProperty Settings: edvPart-NPI_c
					edvPart.dataView.Table.Columns["NPI_c"].ExtendedProperties["Read Only"] = true;
				// End Wizard Added ExtendedProperty Settings: edvPart-NPI_c
				}
			// End Wizard Added Conditional Block
			}
		}
	}
```

---

<div class="post-metadata">

**Author:** ![Metesh](https://www.epiusers.help/user_avatar/www.epiusers.help/metesh/32/62757_2.png) [@Metesh](https://www.epiusers.help/u/Metesh)\
**Post date:** [September 22, 2021, 5:33pm UTC](https://www.epiusers.help/t/checkbox-read-only/41293/8 "2021-09-22T17:33:46Z")

</div>

Hi,

I’m trying to do a similar thing on the order page with a UD checkbox but for some reason nothing is happening. The field does not become read only after it’s checked. Is there something I’m missing?

This is the code I used.

public void InitializeCustomCode()  
{  
// \*\* Wizard Insert Location - Do not delete ‘Begin/End Wizard Added Variable Initialization’ lines \*\*  
// Begin Wizard Added Variable Initialization

```
	// End Wizard Added Variable Initialization

	// Begin Wizard Added Custom Method Calls

	this.chkWarranty.CheckStateChanged += new System.EventHandler(this.chkWarranty_CheckStateChanged);
			
	// End Wizard Added Custom Method Calls
}

public void DestroyCustomCode()
{
	// **Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines**
	// Begin Wizard Added Object Disposal

	this.chkWarranty.CheckStateChanged -= new System.EventHandler(this.chkWarranty_CheckStateChanged);
	

	// End Wizard Added Object Disposal

	// Begin Custom Code Disposal

	// End Custom Code Disposal
}

private void chkWarranty_CheckStateChanged(object sender, System.EventArgs args)
{
	if (chkWarranty.Checked = true)
	{
	
		// Begin Wizard Added EpiDataView Initialization
			EpiDataView edvOrderHed = ((EpiDataView)(this.oTrans.EpiDataViews["OrderHed"]));
		// End Wizard Added EpiDataView Initialization

			// Begin Wizard Added Conditional Block
			if (edvOrderHed.dataView.Table.Columns.Contains("Warranty_c"))
			{
				//Begin Wizard Added ExtendedProperty 
					edvOrderHed.dataView.Table.Columns["Warranty_c"].ExtendedProperties["ReadOnly"] = true;
				// End Wizard Added ExtendedProperty 
			}
			// End Wizard Added Conditional Block
		
	}
}
```

---

<div class="post-metadata">

**Author:** ![Metesh](https://www.epiusers.help/user_avatar/www.epiusers.help/metesh/32/62757_2.png) [@Metesh](https://www.epiusers.help/u/Metesh)\
**Post date:** [September 22, 2021, 8:04pm UTC](https://www.epiusers.help/t/checkbox-read-only/41293/9 "2021-09-22T20:04:59Z")

</div>

I managed to get this working using the Row rule. 🙂

thanks
