I have a customization for a BAQ Report Form this is causing me issues. I am enabling an disabling the Generate button based on if there is a value (a Pack Slip Number) in the field on the form. If there is a value in the field and I delete it and press tab, I am getting the following error:
Application Error
Exception caught in: BAQReportSOPartSNTag.EP.COMSON.Customization.DisAllowNullPS.CustomCode.28
Error Detail
Message: Specified cast is not valid.
Program: BAQReportSOPartSNTag.EP.COMSON.Customization.DisAllowNullPS.CustomCode.28.dll
Method: BAQReportParam_AfterFieldChange
Client Stack Trace
at Script.BAQReportParam_AfterFieldChange(Object sender, DataColumnChangeEventArgs args)
at System.Data.DataColumnChangeEventHandler.Invoke(Object sender, DataColumnChangeEventArgs e)
at System.Data.DataTable.OnColumnChanged(DataColumnChangeEventArgs e)
at Ice.Rpt.BAQReportDataSet.BAQReportParamDataTable.OnColumnChanged(DataColumnChangeEventArgs e)
at System.Data.DataRow.set_Item(DataColumn column, Object value)
at System.Data.DataRowView.SetColumnValue(DataColumn column, Object value)
at System.Data.DataRowView.set_Item(String property, Object value)
at Ice.Lib.Framework.EpiNumericEditor.TextValidate(Object sender, CancelEventArgs ea)
My code is below. I have tried everything I can think of and cannot get it solved. The Customization compiler does not give me an error or warning, it compiles successfully. I am doing the same thing on another BAQ Report Form with Job Number and I am not having any issues. What am I missing?
private void BAQReportParam_AfterFieldChange(object sender, DataColumnChangeEventArgs args)
{
// ** Argument Properties and Uses **
// args.Row["FieldName"]
// args.Column, args.ProposedValue, args.Row
// Add Event Handler Code
switch (args.Column.ColumnName)
{
case "Field1":
EpiDataView BAQReport = oTrans.Factory("ReportParam");
int PackNum = (int)BAQReport.dataView[BAQReport.Row]["Field1"];
if (PackNum == 0)
baseToolbarsManager.Tools["GenerateTool"].SharedProps.Enabled=false;
else
baseToolbarsManager.Tools["GenerateTool"].SharedProps.Enabled=true;
break;
}
}