# Can't make a custom Control Settings work

**URL:** <https://www.epiusers.help/t/cant-make-a-custom-control-settings-work/85281>\
**Category:** Epicor ERP 10\
**Tags:** customization\
**Created:** [December 7, 2021, 5:21pm UTC](https://www.epiusers.help/t/cant-make-a-custom-control-settings-work/85281 "2021-12-07T17:21:19Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![louis.fequet](https://www.epiusers.help/user_avatar/www.epiusers.help/louis.fequet/32/102245_2.png) [@louis.fequet](https://www.epiusers.help/u/louis.fequet)\
**Post date:** [December 7, 2021, 5:21pm UTC](https://www.epiusers.help/t/cant-make-a-custom-control-settings-work/85281/1 "2021-12-07T17:21:20Z")

</div>

Hi all,

I just can’t make my custom ControlSettings work. I’m in 10.2.700.15. When I use SettingStyle (comment line), every thing is ok. Can somebody point me where the problem is…

```auto
private void AddRROnQuoteDtl()
	{
		var quoteDtlView = oTrans.Factory("QuoteDtl");
		var myCustomSetting = new ControlSettings() { BackColor = Color.Orange, ForeColor = Color.Black };	
		
		mandatoryOrderDtlFieldList
			.ForEach(field => 
			{				
				var rrEmptyField = new RowRule( "QuoteDtl." + field, RuleCondition.Equals, "");
	            rrEmptyField.AddAction(RuleAction.AddControlSettings(oTrans, "QuoteDtl." + field, myCustomSetting));
			//	rrEmptyField.AddAction(RuleAction.AddControlSettings(oTrans, "QuoteDtl." + field, SettingStyle.Warning));
	            quoteDtlView.AddRowRule(rrEmptyField);
			});
	}

```

---

<div class="post-metadata">

**Author:** ![Joseph\_Martin](https://www.epiusers.help/user_avatar/www.epiusers.help/joseph_martin/32/16359_2.png) [@Joseph\_Martin](https://www.epiusers.help/u/Joseph_Martin)\
**Post date:** [December 7, 2021, 9:44pm UTC](https://www.epiusers.help/t/cant-make-a-custom-control-settings-work/85281/2 "2021-12-07T21:44:53Z")

</div>

my working version is a bit different, but this should work adapted for you

```auto
var action = RuleAction.AddRowSettings( this.oTrans, "QuoteDtl", false, myCustomSetting);
var actions = new RuleAction[]{ action };
var rrEmptyField = new RowRule( "QuoteDtl." + field, RuleCondition.Equals, "", actions);
quoteDtlView.AddRowRule( rrEmptyField );

```

---

<div class="post-metadata">

**Author:** ![louis.fequet](https://www.epiusers.help/user_avatar/www.epiusers.help/louis.fequet/32/102245_2.png) [@louis.fequet](https://www.epiusers.help/u/louis.fequet)\
**Post date:** [December 8, 2021, 12:23pm UTC](https://www.epiusers.help/t/cant-make-a-custom-control-settings-work/85281/3 "2021-12-08T12:23:37Z")

</div>

Thanks Joseph for your reply,

No, your proposition doesn’t work for my context. But it works (i tried it). In your proposition, your using a RowSettings wich will apply the action on all fields of the row.

My step are:

1- Adding RowRules on Load (I’ve also tried to add them in the Initialize)  
2- After the form is open, I search for a Quote with no lines  
3- After clicking on the GetNew button, the row rules are working with the SettingStyle action but not with the ControlSettings.

I get the same behavior in another screen. I just can’t figure why the ControlSettings doen’t work. I’ve also tried to use the Wizard to create a RowRule and inside of the method, I have replace the SettingStyle by the ControlSettings with not positive result.

Any ideas?

---

<div class="post-metadata">

**Author:** ![Joseph\_Martin](https://www.epiusers.help/user_avatar/www.epiusers.help/joseph_martin/32/16359_2.png) [@Joseph\_Martin](https://www.epiusers.help/u/Joseph_Martin)\
**Post date:** [December 8, 2021, 7:54pm UTC](https://www.epiusers.help/t/cant-make-a-custom-control-settings-work/85281/4 "2021-12-08T19:54:54Z")

</div>

Interesting, I did some testing and the following works for me for individual blank string fields. My guess would be something with the dataview returned from oTran.Factory maybe? The only other difference I see is passing the action[] in the row rule constructor vs. the add action method.

```auto
var view = (EpiDataView)this.oTrans.EpiDataViews["QuoteDtl"];
ControlSettings myControl = new ControlSettings();
myControl.BackColor = System.Drawing.Color.Navy;

fieldList.ForEach( field => 
{
	string binding = view.ViewName + "." + field;		
	view.AddRowRule( 
		new RowRule(binding, RuleCondition.Equals, "", 
			new RuleAction[]
			{ 
				RuleAction.AddControlSettings(this.oTrans, binding, myControl ) 
			})
	);
						
});

```

---

<div class="post-metadata">

**Author:** ![louis.fequet](https://www.epiusers.help/user_avatar/www.epiusers.help/louis.fequet/32/102245_2.png) [@louis.fequet](https://www.epiusers.help/u/louis.fequet)\
**Post date:** [December 8, 2021, 11:08pm UTC](https://www.epiusers.help/t/cant-make-a-custom-control-settings-work/85281/5 "2021-12-08T23:08:17Z")

</div>

Thanks for your help @Joseph_Martin ,

Still not working. I’ve copied and pasted your code with no positive result. Although, the SettingStyle does work.

 ![image](https://www.epiusers.help/uploads/default/original/3X/f/8/f89486c29cd26bb8591fb482cb06c803c507b9ab.png)

---

<div class="post-metadata">

**Author:** ![ckrusen](https://www.epiusers.help/user_avatar/www.epiusers.help/ckrusen/32/50584_2.png) [@ckrusen](https://www.epiusers.help/u/ckrusen)\
**Post date:** [December 9, 2021, 1:57am UTC](https://www.epiusers.help/t/cant-make-a-custom-control-settings-work/85281/6 "2021-12-09T01:57:36Z")

</div>

Don’t pull your hair out. It takes some special magic to use non-built in styles.

Search this site a little more. Particularly for a post by @josecgomez. If I find it I’ll post a link

# Edit

Here you go

> [@Creation of custom styles, or more colors for row rules](https://www.epiusers.help/t/creation-of-custom-styles-or-more-colors-for-row-rules/50146/3):
>
> Example, i used the wizard and then just “changed” the ControlSetting that was passed in private void CreateRowRuleSalesTerCompanyEquals\_Constant\_CompanyID() { // Description: dsf // \*\*\*\* begin autogenerated code \*\*\*\* //Create a custom control setting ControlSettings myCustomSetting = new ControlSettings(); //Set it orange myCustomSetting.BackColor=System.Drawing.Color.Orange; //Assing it to the RowRule RuleAction epireadonlySalesTer\_Comment = RuleAction.AddControlSettings(th…

---

<div class="post-metadata">

**Author:** ![louis.fequet](https://www.epiusers.help/user_avatar/www.epiusers.help/louis.fequet/32/102245_2.png) [@louis.fequet](https://www.epiusers.help/u/louis.fequet)\
**Post date:** [December 9, 2021, 12:11pm UTC](https://www.epiusers.help/t/cant-make-a-custom-control-settings-work/85281/7 "2021-12-09T12:11:24Z")

</div>

Thanks @ckrusen for your support,

> [@louis.fequet](#):
>
> I’ve also tried to use the Wizard to create a RowRule and inside of the method, I have replace the SettingStyle by the ControlSettings with not positive result.

It’s the first thing I did when I notice my code was not working. I did plenty of code with ControlSettings, particularly with the Epicor SDK. I’ll keep investigating …

---

<div class="post-metadata">

**Author:** ![louis.fequet](https://www.epiusers.help/user_avatar/www.epiusers.help/louis.fequet/32/102245_2.png) [@louis.fequet](https://www.epiusers.help/u/louis.fequet)\
**Post date:** [December 13, 2021, 2:55pm UTC](https://www.epiusers.help/t/cant-make-a-custom-control-settings-work/85281/8 "2021-12-13T14:55:40Z")

</div>

Got it. After decompiling the EpiClientLib.dll and making some tests, I finally made it work. First time I’ve encountered such problem. It always worked nicely before. Anyway, I got what I want.

 ![image](https://www.epiusers.help/uploads/default/original/3X/7/1/71af6e12600d0191a8d9df48567591a0126e5aff.png)

EDIT. When the StyleSetName was left empty, it did not have the behavior expected.
