Пример #1
0
        public static void AddTextBox(HtmlTable htmlTable, string resourceClassName, string columnName, string defaultValue, bool isNullable, int maxLength, string errorCssClass, Assembly assembly)
        {
            if (htmlTable == null)
            {
                return;
            }

            if (string.IsNullOrWhiteSpace(columnName))
            {
                return;
            }

            using (var textBox = GetTextBox(columnName + "_textbox", maxLength))
            {
                var label = ScrudLocalizationHelper.GetResourceString(assembly, resourceClassName, columnName);

                textBox.Text = defaultValue;

                if (!isNullable)
                {
                    var required = ScrudFactoryHelper.GetRequiredFieldValidator(textBox, errorCssClass);
                    ScrudFactoryHelper.AddRow(htmlTable, label + Titles.RequiredFieldIndicator, textBox, required);
                    return;
                }

                ScrudFactoryHelper.AddRow(htmlTable, label, textBox);
            }
        }
Пример #2
0
        public static void AddDecimalTextBox(HtmlTable htmlTable, string resourceClassName, string columnName, string defaultValue, bool isNullable, int maxLength, string domain, string errorCssClass, Assembly assembly)
        {
            var textBox = ScrudTextBox.GetTextBox(columnName + "_textbox", maxLength);
            var label   = ScrudLocalizationHelper.GetResourceString(assembly, resourceClassName, columnName);

            var validator = GetDecimalValidator(textBox, domain, errorCssClass);

            textBox.Text = defaultValue;

            if (!isNullable)
            {
                var required = ScrudFactoryHelper.GetRequiredFieldValidator(textBox, errorCssClass);
                ScrudFactoryHelper.AddRow(htmlTable, label + Titles.RequiredFieldIndicator, textBox, validator, required);
                return;
            }

            ScrudFactoryHelper.AddRow(htmlTable, label, textBox, validator);
        }
Пример #3
0
        internal static void AddDecimalTextBox(HtmlTable htmlTable, string resourceClassName, string columnName, string defaultValue, bool isNullable, int maxLength, string domain, string errorCssClass, Assembly assembly, bool disabled)
        {
            using (TextBox textBox = ScrudTextBox.GetTextBox(columnName + "_textbox", maxLength))
            {
                string label = ScrudLocalizationHelper.GetResourceString(assembly, resourceClassName, columnName);

                using (CompareValidator validator = GetDecimalValidator(textBox, domain, errorCssClass))
                {
                    textBox.Text     = defaultValue;
                    textBox.ReadOnly = disabled;

                    if (!isNullable)
                    {
                        RequiredFieldValidator required = ScrudFactoryHelper.GetRequiredFieldValidator(textBox, errorCssClass);
                        ScrudFactoryHelper.AddRow(htmlTable, label + Titles.RequiredFieldIndicator, textBox, validator, required);
                        return;
                    }

                    ScrudFactoryHelper.AddRow(htmlTable, label, textBox, validator);
                }
            }
        }