本文整理汇总了C#中ModelMetadata.GetColumnEditOptions方法的典型用法代码示例。如果您正苦于以下问题:C# ModelMetadata.GetColumnEditOptions方法的具体用法?C# ModelMetadata.GetColumnEditOptions怎么用?C# ModelMetadata.GetColumnEditOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelMetadata
的用法示例。
在下文中一共展示了ModelMetadata.GetColumnEditOptions方法的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();
}