Example #1
0
 public void SetReadOnly(string controlId, bool readOnlyValue)
 {
     FormHelperClass.SetReadOnly(this.GetControl(controlId), readOnlyValue);
 }
Example #2
0
        public void SetNullItemClickBase(object sender, DataRow currentRow)
        {
            Control sourceControl = ((ContextMenu)((MenuItem)sender).Parent).SourceControl;
            string  controlId     = "";

            if (sourceControl.Tag != null)
            {
                controlId = Conversions.ToString(sourceControl.Tag);
            }
            if (sourceControl is DeklaritComboBox)
            {
                DeklaritComboBox box = (DeklaritComboBox)sourceControl;
                if (box.ComboBox.Tag != null)
                {
                    controlId         = Conversions.ToString(box.ComboBox.Tag);
                    box.SelectedIndex = -1;
                }
            }
            if ((controlId.Length == 0) && (sourceControl.Parent != null))
            {
                sourceControl = sourceControl.Parent;
                controlId     = Conversions.ToString(sourceControl.Tag);
            }
            this.GetControl(controlId).Focus();
            if (sourceControl is TextBox)
            {
                TextBox box2 = (TextBox)sourceControl;
                box2.Text = "";
            }
            if (sourceControl is UltraDateTimeEditor)
            {
                UltraDateTimeEditor editor = (UltraDateTimeEditor)sourceControl;
                editor.Value = RuntimeHelpers.GetObjectValue(Convert.DBNull);
            }
            if (sourceControl is UltraTextEditor)
            {
                UltraTextEditor editor2 = (UltraTextEditor)sourceControl;
                editor2.Text = "";
            }
            if (sourceControl is UltraNumericEditor)
            {
                UltraNumericEditor editor3 = (UltraNumericEditor)sourceControl;
                editor3.Value = RuntimeHelpers.GetObjectValue(Convert.DBNull);
            }
            if (sourceControl is UltraMaskedEdit)
            {
                UltraMaskedEdit edit = (UltraMaskedEdit)sourceControl;
                edit.Text = "";
            }
            if (sourceControl is LinkUltraLabelPrompt)
            {
                LinkUltraLabelPrompt prompt = (LinkUltraLabelPrompt)sourceControl;
                prompt.UltraLabel.Text = "";
                prompt.UltraLabel.Focus();
                string descriptionTag = prompt.DescriptionTag;
                if ((descriptionTag != null) && (descriptionTag.Length != 0))
                {
                    currentRow[descriptionTag] = RuntimeHelpers.GetObjectValue(Convert.DBNull);
                }
            }
            currentRow[controlId] = RuntimeHelpers.GetObjectValue(Convert.DBNull);
            DataColumn column = currentRow.Table.Columns[controlId];

            if (((column != null) && (column.ExtendedProperties["TreatEmptyAsNull"] != null)) && (Convert.ToBoolean(column.ExtendedProperties["TreatEmptyAsNull"].ToString()) && !column.DataType.Equals(typeof(DateTime))))
            {
                currentRow[controlId] = RuntimeHelpers.GetObjectValue(FormHelperClass.EmptyValue(column.DataType));
            }
        }