# Lock or Unlock Cell by Row Rule

**URL:** <https://www.epiusers.help/t/lock-or-unlock-cell-by-row-rule/60961>\
**Category:** Epicor ERP 10\
**Tags:** baq, dashboard, customization\
**Created:** [October 18, 2019, 6:04pm UTC](https://www.epiusers.help/t/lock-or-unlock-cell-by-row-rule/60961 "2019-10-18T18:04:05Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![NateS](https://www.epiusers.help/user_avatar/www.epiusers.help/nates/32/18519_2.png) [@NateS](https://www.epiusers.help/u/NateS)\
**Post date:** [October 18, 2019, 6:04pm UTC](https://www.epiusers.help/t/lock-or-unlock-cell-by-row-rule/60961/1 "2019-10-18T18:04:05Z")

</div>

Hi again!  
I really appreciate this community. You all have been very helpful. Thank you for taking time out of your day to help me!

I have a dashboard with a BAQ. In the BAQ I have a calculated checkbox field called ‘Manual’ that = false. I also have two epicor fields: OrderRel.OurReqQty and OrderRel.ReqDate.

On the dashboard I would like to be able to have the date and qty fields locked so that normally users cannot edit the values. However, if the user clicks the checkbox to ‘unlock’ that row, then I want the two columns to get unlocked so that the user can edit the values before running the update method.

I see that I can set the column to read only, but at runtime it looks like read only is a ‘get’ property, and not a ‘set’ property.

How can I keep the two fields read only until the user indicates their intent to edit that record by clicking the checkbox?

Here is the base code I have so far. It creates the rule based on the checkbox, but I am not sure how to act on the rule once created:

```cs
	private void CreateRowRuleV_Cust_OurUnmatchedOrders_faster_1ViewCalculated_ManualEquals_true()
	{
		// Description: ManualEdit
		// ****begin autogenerated code****
		RuleAction[] ruleActions = new RuleAction[0];
		// Create RowRule and add to the EpiDataView.
		// Dummy Context Object
		object contextObject = null;
		RowRule rrCreateRowRuleV_Cust_OurUnmatchedOrders_faster_1ViewCalculated_ManualEquals_true = new RowRule("V_Cust_OurUnmatchedOrders_faster_1View.Calculated_Manual", RuleCondition.Equals, true, new RowRuleActionDelegate2(this.V_Cust_OurUnmatchedOrders_faster_1ViewCalculated_ManualEqualstrue_CustomRuleAction), contextObject);
		((EpiDataView)(this.oTrans.EpiDataViews["V_Cust_OurUnmatchedOrders_faster_1View"])).AddRowRule(rrCreateRowRuleV_Cust_OurUnmatchedOrders_faster_1ViewCalculated_ManualEquals_true);
		// ****end autogenerated code****
	}

	private void V_Cust_OurUnmatchedOrders_faster_1ViewCalculated_ManualEqualstrue_CustomRuleAction(Ice.Lib.ExtendedProps.RowRuleDelegateArgs args)
	{
		// ** RowRuleDelegateArgs Properties: args.Arg1, args.Arg2, args.Context, args.Row
		// ** put custom Rule Action logic here
		// set qty and date fields to readonly=false
		String myRef ="64a4559a-a942-4836-98d0-eb53fb6fc5c0";	
		EpiUltraGrid mesGrid;		
		mesGrid = (EpiUltraGrid)csm.GetNativeControlReference(myRef);
		/// these lines dont work
mesGrid.ActiveCell.Column("OrderRel_OurReqQty").ReadOnly=false;
mesGrid.ActiveCell.Column("OrderRel_ReqDate").ReadOnly=false;
	}

```

Thanks again for your time!  
Nate

---

<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:** [October 18, 2019, 6:20pm UTC](https://www.epiusers.help/t/lock-or-unlock-cell-by-row-rule/60961/2 "2019-10-18T18:20:29Z")

</div>

SO this is intended to work on a row-by-row level? Meaning you have that calculated boolean field named “Manual”, and that when that is checked, those other two fields - on just this row - are enabled for editing?

Obviously this would need to be a uBAQ for the edits to be writable back to the db. But how is the “Manual” filed checkbox updatable, such that you can check it?

---

<div class="post-metadata">

**Author:** ![NateS](https://www.epiusers.help/user_avatar/www.epiusers.help/nates/32/18519_2.png) [@NateS](https://www.epiusers.help/u/NateS)\
**Post date:** [October 18, 2019, 6:23pm UTC](https://www.epiusers.help/t/lock-or-unlock-cell-by-row-rule/60961/3 "2019-10-18T18:23:02Z")

</div>

Yes you got it right. Right now I set all three fields to updatable. So when I run the query I can check the checkbox, and then edit the required fields. I just want to lock them so users cant edit them unless they really mean to.

This is a uBAQ. I am using custom actions already. I hope that I can integrate this in with my custom update method.

---

<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:** [October 18, 2019, 6:33pm UTC](https://www.epiusers.help/t/lock-or-unlock-cell-by-row-rule/60961/4 "2019-10-18T18:33:34Z")

</div>

Since it’s row by row, could you make the whole row editable? The uBAQ would only allow the updateble fields to actually update.

---

<div class="post-metadata">

**Author:** ![Asz0ka](https://www.epiusers.help/letter_avatar_proxy/v4/letter/a/a698b9/32.png) [@Asz0ka](https://www.epiusers.help/u/Asz0ka)\
**Post date:** [October 18, 2019, 6:59pm UTC](https://www.epiusers.help/t/lock-or-unlock-cell-by-row-rule/60961/5 "2019-10-18T18:59:06Z")

</div>

You should be able to do this with UltraGridColumn.CellActivation = Activation.AllowEdit /Activation.NoEdit

There’s a good source of starter code here:

> **[Documentation Archives | Infragistics](https://www.infragistics.com/support/archived-documentation)**
>
> Find documentation for end-of-life products, including developer guides, API reference guides, and more. Frameworks include jQuery, ASP.NET, Windows Forms, and WPF.

---

<div class="post-metadata">

**Author:** ![Jason\_Woods](https://www.epiusers.help/user_avatar/www.epiusers.help/jason_woods/32/80101_2.png) [@Jason\_Woods](https://www.epiusers.help/u/Jason_Woods)\
**Post date:** [October 19, 2019, 5:01am UTC](https://www.epiusers.help/t/lock-or-unlock-cell-by-row-rule/60961/6 "2019-10-19T05:01:16Z")

</div>

Try doing a basic row rule in a customization on the deployed dashboard instead. You should not have to write any code that way (the wizard will do it for you).

---

<div class="post-metadata">

**Author:** ![surendrapal](https://www.epiusers.help/user_avatar/www.epiusers.help/surendrapal/32/6162_2.png) [@surendrapal](https://www.epiusers.help/u/surendrapal)\
**Post date:** [October 19, 2019, 12:46pm UTC](https://www.epiusers.help/t/lock-or-unlock-cell-by-row-rule/60961/7 "2019-10-19T12:46:45Z")

</div>

this is what you are looking? if yes go dashboard gird properties -\> View Rule Tab -\> create new rules

 ![test](https://epiusers.help/uploads/default/original/3X/1/b/1b069eceb7ec1595c4f3b338c715400aedd4720b.gif)

---

<div class="post-metadata">

**Author:** ![NateS](https://www.epiusers.help/user_avatar/www.epiusers.help/nates/32/18519_2.png) [@NateS](https://www.epiusers.help/u/NateS)\
**Post date:** [October 23, 2019, 4:06pm UTC](https://www.epiusers.help/t/lock-or-unlock-cell-by-row-rule/60961/8 "2019-10-23T16:06:05Z")

</div>

> [@Jason\_Woods](#):
>
> Try doing a basic row rule in a customization

Yes! This is what I really want to do, but I can’t figure out how to use the rule to change the locked status.

---

<div class="post-metadata">

**Author:** ![NateS](https://www.epiusers.help/user_avatar/www.epiusers.help/nates/32/18519_2.png) [@NateS](https://www.epiusers.help/u/NateS)\
**Post date:** [October 23, 2019, 4:10pm UTC](https://www.epiusers.help/t/lock-or-unlock-cell-by-row-rule/60961/9 "2019-10-23T16:10:53Z")

</div>

> [@surendrapal](#):
>
> go dashboard gird properties → View Rule Tab → create new rules

It seems like I can only set visual styles with the rules. How do I use the rule to set the locked status for other columns?

---

<div class="post-metadata">

**Author:** ![surendrapal](https://www.epiusers.help/user_avatar/www.epiusers.help/surendrapal/32/6162_2.png) [@surendrapal](https://www.epiusers.help/u/surendrapal)\
**Post date:** [October 23, 2019, 4:19pm UTC](https://www.epiusers.help/t/lock-or-unlock-cell-by-row-rule/60961/10 "2019-10-23T16:19:10Z")

</div>

here is  
 ![image](https://epiusers.help/uploads/default/original/3X/1/a/1a8be4fcfb5369b64498109cc8fb4353e8700773.png)

---

<div class="post-metadata">

**Author:** ![NateS](https://www.epiusers.help/user_avatar/www.epiusers.help/nates/32/18519_2.png) [@NateS](https://www.epiusers.help/u/NateS)\
**Post date:** [October 23, 2019, 4:42pm UTC](https://www.epiusers.help/t/lock-or-unlock-cell-by-row-rule/60961/11 "2019-10-23T16:42:06Z")

</div>

This is good. I was trying to set the rules in my customization. I forgot to go all the way back to my dashboard definition. 😛

Right now the rule turns the read-only value on when I click the checkbox. How do I invert that so the read-only is set to false when I click the checkbox?

---

<div class="post-metadata">

**Author:** ![surendrapal](https://www.epiusers.help/user_avatar/www.epiusers.help/surendrapal/32/6162_2.png) [@surendrapal](https://www.epiusers.help/u/surendrapal)\
**Post date:** [October 23, 2019, 4:44pm UTC](https://www.epiusers.help/t/lock-or-unlock-cell-by-row-rule/60961/12 "2019-10-23T16:44:38Z")

</div>

it will take care automatically

---

<div class="post-metadata">

**Author:** ![NateS](https://www.epiusers.help/user_avatar/www.epiusers.help/nates/32/18519_2.png) [@NateS](https://www.epiusers.help/u/NateS)\
**Post date:** [October 23, 2019, 5:08pm UTC](https://www.epiusers.help/t/lock-or-unlock-cell-by-row-rule/60961/13 "2019-10-23T17:08:07Z")

</div>

Did you set the Quantity and Date fields to “Prompt”?

---

<div class="post-metadata">

**Author:** ![surendrapal](https://www.epiusers.help/user_avatar/www.epiusers.help/surendrapal/32/6162_2.png) [@surendrapal](https://www.epiusers.help/u/surendrapal)\
**Post date:** [October 23, 2019, 5:10pm UTC](https://www.epiusers.help/t/lock-or-unlock-cell-by-row-rule/60961/14 "2019-10-23T17:10:12Z")

</div>

Yes you have to set Prompt editable fields

![image](https://epiusers.help/uploads/default/original/3X/c/4/c4a0edfbbde5999d4f424a90160daf78067621bc.png)

---

<div class="post-metadata">

**Author:** ![NateS](https://www.epiusers.help/user_avatar/www.epiusers.help/nates/32/18519_2.png) [@NateS](https://www.epiusers.help/u/NateS)\
**Post date:** [October 23, 2019, 5:17pm UTC](https://www.epiusers.help/t/lock-or-unlock-cell-by-row-rule/60961/15 "2019-10-23T17:17:55Z")

</div>

Ahh! I forgot to set the rule to checkbox = false.  
Thank you!!
