当前位置: 首页>>代码示例>>C#>>正文


C# ModelMetadata.GetColumnFormOptions方法代码示例

本文整理汇总了C#中ModelMetadata.GetColumnFormOptions方法的典型用法代码示例。如果您正苦于以下问题:C# ModelMetadata.GetColumnFormOptions方法的具体用法?C# ModelMetadata.GetColumnFormOptions怎么用?C# ModelMetadata.GetColumnFormOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ModelMetadata的用法示例。


在下文中一共展示了ModelMetadata.GetColumnFormOptions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: JqGridColumnModel

        internal JqGridColumnModel(ModelMetadata propertyMetadata)
            : this(propertyMetadata.PropertyName)
        {
            IEnumerable<object> customAttributes  = propertyMetadata.ContainerType.GetProperty(propertyMetadata.PropertyName).GetCustomAttributes(true).AsEnumerable();

            TimestampAttribute timeStampAttribute = customAttributes.OfType<TimestampAttribute>().FirstOrDefault();
            if (timeStampAttribute != null)
            {
                Editable = true;
                Hidden = true;
            }
            else
            {
                RangeAttribute rangeAttribute = customAttributes.OfType<RangeAttribute>().FirstOrDefault();

                Alignment = propertyMetadata.GetColumnAlignment();
                CellAttributes = propertyMetadata.GetColumnCellAttributes();
                Classes = propertyMetadata.GetColumnClasses();
                DateFormat = propertyMetadata.GetColumnDateFormat();
                Fixed = propertyMetadata.GetColumnFixed();
                Frozen = propertyMetadata.GetColumnFrozen();
                Key = propertyMetadata.GetColumnKey();
                Resizable = propertyMetadata.GetColumnResizable();
                Title = propertyMetadata.GetColumnTitle();
                Width = propertyMetadata.GetColumnWidth();
                Viewable = propertyMetadata.GetColumnViewable();

                Editable = propertyMetadata.GetColumnEditable();
                EditOptions = propertyMetadata.GetColumnEditOptions();
                if (EditOptions != null)
                {
                    StringLengthAttribute stringLengthAttribute = customAttributes.OfType<StringLengthAttribute>().FirstOrDefault();
                    if (stringLengthAttribute != null)
                    {
                        if (EditOptions.HtmlAttributes == null)
                            EditOptions.HtmlAttributes = new Dictionary<string, object>();

                        if (EditOptions.HtmlAttributes.ContainsKey("maxlength"))
                            EditOptions.HtmlAttributes["maxlength"] = stringLengthAttribute.MaximumLength;
                        else
                            EditOptions.HtmlAttributes.Add("maxlength", stringLengthAttribute.MaximumLength);
                    }
                }
                EditRules = propertyMetadata.GetColumnEditRules();
                if (EditRules != null)
                {
                    RequiredAttribute requiredAttribute = customAttributes.OfType<RequiredAttribute>().FirstOrDefault();
                    if (requiredAttribute != null)
                        EditRules.Required = true;

                    if (rangeAttribute != null)
                    {
                        EditRules.MaxValue = Convert.ToDouble(rangeAttribute.Maximum);
                        EditRules.MinValue = Convert.ToDouble(rangeAttribute.Minimum);
                    }
                }
                EditType = propertyMetadata.GetColumnEditType();

                Formatter = propertyMetadata.GetColumnFormatter();
                FormatterOptions = propertyMetadata.GetColumnFormatterOptions();
                UnFormatter = propertyMetadata.GetColumnUnFormatter();

                FormOptions = propertyMetadata.GetColumnFormOptions();

                LabelOptions = propertyMetadata.GetColumnLabelOptions();

                Searchable = propertyMetadata.GetColumnSearchable();
                SearchOptions = propertyMetadata.GetColumnSearchOptions();
                SearchRules = propertyMetadata.GetColumnSearchRules();
                if (SearchRules != null && rangeAttribute != null)
                {
                    SearchRules.MaxValue = Convert.ToDouble(rangeAttribute.Maximum);
                    SearchRules.MinValue = Convert.ToDouble(rangeAttribute.Minimum);
                }
                SearchType = propertyMetadata.GetColumnSearchType();

                InitialSortingOrder = propertyMetadata.GetColumnInitialSortingOrder();
                Sortable = propertyMetadata.GetColumnSortable();
                SortType = propertyMetadata.GetColumnSortType();
                SortFunction = propertyMetadata.GetColumnSortFunction();
                Index = propertyMetadata.GetColumnIndex();

                SummaryType = propertyMetadata.GetColumnSummaryType();
                SummaryTemplate = propertyMetadata.GetColumnSummaryTemplate();
                SummaryFunction = propertyMetadata.GetColumnSummaryFunction();

                if (!String.IsNullOrWhiteSpace(propertyMetadata.TemplateHint) && propertyMetadata.TemplateHint.Equals("HiddenInput"))
                    Hidden = true;
                else
                    Hidden = false;
                HideInDialog = propertyMetadata.GetColumnHideInDialog();
            }

            JsonMapping = propertyMetadata.GetColumnJsonMapping();
            XmlMapping = propertyMetadata.GetColumnXmlMapping();
        }
开发者ID:likhi1,项目名称:Lib.Web.Mvc,代码行数:96,代码来源:JqGridColumnModel.cs


注:本文中的ModelMetadata.GetColumnFormOptions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。