예제 #1
0
        protected override void SetControlMaskSettings(DevExpress.ExpressApp.Editors.PropertyEditor propertyEditor, BusinessObjects.EditMask mask)
        {
            if (propertyEditor is ASPxStringPropertyEditor)
            {
                ASPxTextBox textEdit = ((ASPxStringPropertyEditor)propertyEditor).Editor as ASPxTextBox;
                if (textEdit != null)
                {
                    switch (mask)
                    {
                    case BusinessObjects.EditMask.Date:
                        textEdit.MaskSettings.Mask = "MM/dd/yyyy";
                        break;

                    case BusinessObjects.EditMask.Time:
                        textEdit.MaskSettings.Mask = "hh:mm tt";
                        break;

                    case BusinessObjects.EditMask.Numeric:
                        textEdit.MaskSettings.Mask = "0999999999";
                        break;

                    case BusinessObjects.EditMask.String:
                        textEdit.MaskSettings.Mask = "";
                        break;
                    }
                }
            }
        }
        protected override void SetControlMaskSettings(DevExpress.ExpressApp.Editors.PropertyEditor propertyEditor, BusinessObjects.EditMask mask)
        {
            if (propertyEditor is StringPropertyEditor)
            {
                TextEdit textEdit = ((StringPropertyEditor)propertyEditor).Control;
                switch (mask)
                {
                case BusinessObjects.EditMask.Date:
                    textEdit.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.DateTime;
                    textEdit.Properties.Mask.EditMask = "d";
                    break;

                case BusinessObjects.EditMask.Time:
                    textEdit.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.DateTime;
                    textEdit.Properties.Mask.EditMask = "t";
                    break;

                case BusinessObjects.EditMask.Numeric:
                    textEdit.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric;
                    textEdit.Properties.Mask.EditMask = "d";
                    break;

                case BusinessObjects.EditMask.String:
                    textEdit.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.None;
                    textEdit.Properties.Mask.EditMask = "";
                    break;
                }
            }
        }