本文整理汇总了C#中System.Web.DynamicData.MetaColumn类的典型用法代码示例。如果您正苦于以下问题:C# MetaColumn类的具体用法?C# MetaColumn怎么用?C# MetaColumn使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MetaColumn类属于System.Web.DynamicData命名空间,在下文中一共展示了MetaColumn类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ChangeValueType
private static object ChangeValueType(MetaColumn column, string value) {
if (column.ColumnType == typeof(Guid)) {
return new Guid(value);
} else {
return Convert.ChangeType(value, column.TypeCode, CultureInfo.InvariantCulture);
}
}
示例2: CreateFieldTemplate
public override IFieldTemplate CreateFieldTemplate(MetaColumn column, DataBoundControlMode mode, string uiHint)
{
if (column.IsReadOnly)// code to fix caching issue
mode = DataBoundControlMode.ReadOnly;
return base.CreateFieldTemplate(column, mode, uiHint);
}
示例3: IsShown
//-------------------------------------------------------------------------------------------
public static Boolean IsShown(MetaColumn column)
{
// need to get the current page template
var page = (System.Web.UI.Page)System.Web.HttpContext.Current.CurrentHandler;
var pageTemplate = page.GetPageTemplate();
var hideIn = column.GetAttribute<HideColumnInAttribute>();
if (hideIn != null && (hideIn.PageTemplates.Contains(pageTemplate)))
return false;
var hideIfFiltered = column.GetAttribute<HideIfFiltered>();
if (hideIfFiltered != null &&
(System.Web.HttpContext.Current.Request[column.Name] != null ||
(hideIfFiltered.FilterName != null &&
System.Web.HttpContext.Current.Request[hideIfFiltered.FilterName] != null))
)
return false;
var securedColumns = column.GetColumnPermissions(System.Web.Security.Roles.GetRolesForUser());
if (securedColumns.Contains(ColumnActions.DenyRead))
return false;
//foreach (var secureColumn in securedColumns)
//{
// if (securedColumn
//}
return true;
}
示例4: CreateTextTemplate
public static SimpleFieldTemplateUserControl CreateTextTemplate(MetaColumn column, bool readOnly) {
SimpleFieldTemplateUserControl control = new SimpleFieldTemplateUserControl();
if (readOnly) {
var literal = new Literal();
literal.DataBinding += (sender, e) => {
literal.Text = control.FieldValueString;
};
control.Controls.Add(literal);
}
else {
var textBox = new TextBox();
textBox.DataBinding += (sender, e) => {
textBox.Text = control.FieldValueEditString;
};
// Logic copied from BoundField
if (column.ColumnType.IsPrimitive) {
textBox.Columns = 5;
}
control._valueExtrator = () => textBox.Text;
textBox.CssClass = "DDTextBox";
textBox.ID = TextBoxID;
control.Controls.Add(textBox);
control.CreateValidators(column);
}
return control;
}
示例5: IsAuthorized
//-------------------------------------------------------------------------------------------
public static Boolean IsAuthorized(MetaColumn column)
{
var securedColumns = column.GetColumnPermissions(System.Web.Security.Roles.GetRolesForUser());
if (securedColumns.Contains(ColumnActions.DenyRead))
return false;
return true;
}
示例6: GetFilterVirtualPathWithCaching
// internal for unit testing
internal string GetFilterVirtualPathWithCaching(MetaColumn column, string filterUIHint) {
Debug.Assert(column != null);
long cacheKey = Misc.CombineHashCodes(column, filterUIHint);
return _templateFactory.GetTemplatePath(cacheKey, delegate() {
return GetFilterVirtualPath(column, filterUIHint);
});
}
示例7: OnLoad
protected override void OnLoad(EventArgs e) {
foreach (MetaColumn column in Table.GetScaffoldColumns(Mode, ContainerType)) {
currentColumn = column;
Control item = new DefaultEntityTemplate._NamingContainer();
EntityTemplate1.ItemTemplate.InstantiateIn(item);
EntityTemplate1.Controls.Add(item);
}
}
示例8: IncludeField
private bool IncludeField(MetaColumn column, DataBoundControlMode mode) {
// Exclude bool columns in Insert mode (just to test custom filtering)
if (mode == DataBoundControlMode.Insert && column.ColumnType == typeof(bool))
return false;
return true;
}
示例9: CreateFieldTemplate
private IFieldTemplate CreateFieldTemplate(bool readOnly, MetaColumn column) {
// By default we'll support checkbox fields for boolean and a textbox for
// everything else
if (column.ColumnType == typeof(bool)) {
return SimpleFieldTemplateUserControl.CreateBooleanTemplate(readOnly);
}
return SimpleFieldTemplateUserControl.CreateTextTemplate(column, readOnly);
}
示例10: GetFilterVirtualPath
public virtual string GetFilterVirtualPath(MetaColumn column, string filterUIHint) {
if (column == null) {
throw new ArgumentNullException("column");
}
string filterControlName = BuildFilterVirtualPath(column, filterUIHint);
string filterTemplatePath = VirtualPathUtility.Combine(FilterFolderVirtualPath, filterControlName + ".ascx");
return filterTemplatePath;
}
示例11: SetParameterTypeCodeAndDbType
internal static void SetParameterTypeCodeAndDbType(Parameter parameter, MetaColumn column) {
// If it's a Guid, use a DbType, since TypeCode doesn't support it. For everything else, use TypeCode
if (column.ColumnType == typeof(Guid)) {
parameter.DbType = DbType.Guid;
}
else {
parameter.Type = column.TypeCode;
}
}
示例12: IsHidden
private static Boolean IsHidden(MetaColumn column)
{
var browsable = column.Attributes.OfType<BrowsableAttribute>().SingleOrDefault();
if (browsable == null)
{
return false;
}
return !browsable.Browsable;
}
示例13: CreateField
protected virtual DynamicField CreateField(MetaColumn column, ContainerType containerType, DataBoundControlMode mode) {
string headerText = (containerType == ContainerType.List ? column.ShortDisplayName : column.DisplayName);
var field = new DynamicField() {
DataField = column.Name,
HeaderText = headerText
};
// Turn wrapping off by default so that error messages don't show up on the next line.
field.ItemStyle.Wrap = false;
return field;
}
示例14: CreateFilterControl
public virtual QueryableFilterUserControl CreateFilterControl(MetaColumn column, string filterUIHint) {
if (column == null) {
throw new ArgumentNullException("column");
}
string filterTemplatePath = GetFilterVirtualPathWithCaching(column, filterUIHint);
Debug.Assert(filterTemplatePath != null);
QueryableFilterUserControl filter = (QueryableFilterUserControl)BuildManager.CreateInstanceFromVirtualPath(
filterTemplatePath, typeof(QueryableFilterUserControl));
return filter;
}
示例15: GetDefaultFilterControlName
private string GetDefaultFilterControlName(MetaColumn column) {
if (column is MetaForeignKeyColumn) {
return s_foreignKeyFilter;
}
else if (column.ColumnType == typeof(bool)) {
return s_booleanFilter;
}
else if (column.GetEnumType() != null) {
return s_enumerationFilter;
}
else {
throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture,
Resources.DynamicDataResources.FilterFactory_ColumnHasNoDefaultFilter,
column.Name,
column.Table.Name));
}
}