本文整理汇总了C#中System.Web.UI.WebControls.GridView.IsBindableType方法的典型用法代码示例。如果您正苦于以下问题:C# GridView.IsBindableType方法的具体用法?C# GridView.IsBindableType怎么用?C# GridView.IsBindableType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.GridView
的用法示例。
在下文中一共展示了GridView.IsBindableType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GridView_IsBindableType
public void GridView_IsBindableType ()
{
Type [] types = new Type [] {
typeof(Boolean),
typeof(Byte),
typeof(Char),
typeof(DateTime),
typeof(Decimal),
typeof(Double),
typeof(Guid),
typeof(Int16),
typeof(Int32),
typeof(Int64),
typeof(SByte),
typeof(Single),
typeof(String),
typeof(UInt16),
typeof(UInt32),
typeof(UInt64)
};
GridView g = new GridView ();
foreach (Type type in types)
Assert.AreEqual (true, g.IsBindableType (type), type.ToString ());
Assert.AreEqual (false, g.IsBindableType (typeof (Enum)), "test");
Assert.AreEqual (false, g.IsBindableType (typeof (Object)), "test");
}
示例2: ShouldGenerateField
private bool ShouldGenerateField(Type propertyType, GridView gridView) {
if (gridView.RenderingCompatibility < VersionUtil.Framework45 && AutoGenerateEnumFields == null) {
//This is for backward compatibility. Before 4.5, auto generating fields used to call into this method
//and if someone has overriden this method to force generation of columns, the scenario should still
//work.
return gridView.IsBindableType(propertyType);
}
else {
//If AutoGenerateEnumFileds is null here, the rendering compatibility must be 4.5
return DataBoundControlHelper.IsBindableType(propertyType, enableEnums: AutoGenerateEnumFields ?? true);
}
}