On InitializeCustomCode I set the line description to be ready only. This updates the UI and disables editing the description as I would expect. Then I have a button that toggles the read only state:
The message box displays true, false, true, false as you keep clicking it, as I would expect. But the UI does not reflect that at all, it stays in the same state it started in.
after updating your code on the UI, clear your cache, log off/on, go to the Customization Maintenance BO, and search and select it, then run a verification process.
Still not updating… I cleared client cache and closed and re-opened epicor to be sure. I know the read only value is being set correctly, because when I click the “Description” button by the actual description field to open the larger editor it allows/disallows editing based off what the message box said. But the text box remains disabled…
Here is all of the code in the customization…
// **************************************************
// Custom code for QuoteForm
// Created: 8/28/2018 3:59:38 PM
// **************************************************
extern alias Erp_Contracts_BO_QuoteDtlSearch;
extern alias Erp_Contracts_BO_Quote;
extern alias Erp_Contracts_BO_Customer;
extern alias Erp_Contracts_BO_AlternatePart;
extern alias Erp_Contracts_BO_Part;
extern alias Erp_Contracts_BO_Vendor;
extern alias Erp_Contracts_BO_VendorPPSearch;
extern alias Erp_Contracts_BO_ShipTo;
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 **
private EpiDataView edvQuoteDtl;
private EpiBaseAdapter oTrans_adapter;
// 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
SetExtendedProperties();
this.epiButtonC1.Click += new System.EventHandler(this.epiButtonC1_Click);
// 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.epiButtonC1.Click -= new System.EventHandler(this.epiButtonC1_Click);
// End Wizard Added Object Disposal
// Begin Custom Code Disposal
// End Custom Code Disposal
}
private void SetExtendedProperties()
{
// Begin Wizard Added EpiDataView Initialization
EpiDataView edvQuoteDtl = ((EpiDataView)(this.oTrans.EpiDataViews["QuoteDtl"]));
// End Wizard Added EpiDataView Initialization
// Begin Wizard Added Conditional Block
if (edvQuoteDtl.dataView.Table.Columns.Contains("LineDesc"))
{
// Begin Wizard Added ExtendedProperty Settings: edvQuoteDtl-LineDesc
edvQuoteDtl.dataView.Table.Columns["LineDesc"].ExtendedProperties["ReadOnly"] = true;
// End Wizard Added ExtendedProperty Settings: edvQuoteDtl-LineDesc
}
// End Wizard Added Conditional Block
}
private void epiButtonC1_Click(object sender, System.EventArgs args)
{
// ** Place Event Handling Code Here **
EpiDataView edvQuoteDtl = ((EpiDataView)(this.oTrans.EpiDataViews["QuoteDtl"]));
edvQuoteDtl.dataView.Table.Columns["LineDesc"].ExtendedProperties["ReadOnly"] = !(bool)edvQuoteDtl.dataView.Table.Columns["LineDesc"].ExtendedProperties["ReadOnly"];
this.oTrans.NotifyAll();
MessageBox.Show(edvQuoteDtl.dataView.Table.Columns["LineDesc"].ExtendedProperties["ReadOnly"].ToString());
edvQuoteDtl.Notify(new EpiNotifyArgs(oTrans, edvQuoteDtl.Row, EpiTransaction.NotifyType.Initialize));
}
}
It toggles the read only for the button and not the textbox… Also what do you mean by put it back? Do I just need to store something in a variable and restore it later or what?
EDIT: Looks like I would have to call EpiDataView.ClearManualRowProp(columnName); – anything else?
OK, that code does what I want if I use another field, like JobComment. But when I use the LineDesc it only enables and disables the button. How can I make it disable/enable the textbox?
It should just work assuming the text box is EpiBound to the same field. With that said, why would it disable the button? Are you sure you are referencing the right field?
This is not a fix to the problem, but it may help. One thing I’ve gotten in the habit of doing is putting a version number in the title bar. So, something like “Order Entry v1.1”. That way, when you make a change, you can update the version number. If you open the customization or a user calls you, it’s real easy to ask what the version number shows and find out whether they (or you) are running the current version or if you’ve got caching issues.