本文整理汇总了C#中System.Web.UI.Design.DesignerDataSourceView类的典型用法代码示例。如果您正苦于以下问题:C# DesignerDataSourceView类的具体用法?C# DesignerDataSourceView怎么用?C# DesignerDataSourceView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DesignerDataSourceView类属于System.Web.UI.Design命名空间,在下文中一共展示了DesignerDataSourceView类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CustomDesignDataSourceView
// A design-time data source view
public class CustomDesignDataSourceView : DesignerDataSourceView
{
private ArrayList _data = null;
public CustomDesignDataSourceView(
CustomDataSourceDesigner owner, string viewName)
: base(owner, viewName)
{}
// Get data for design-time display
public override IEnumerable GetDesignTimeData(
int minimumRows, out bool isSampleData)
{
if (_data == null)
{
// Create a set of design-time fake data
_data = new ArrayList();
for (int i = 1; i <= minimumRows; i++)
{
_data.Add(new BookItem("ID_" + i.ToString(),
"Design-Time Title 0" + i.ToString()));
}
}
isSampleData = true;
return _data as IEnumerable;
}
public override IDataSourceViewSchema Schema
{
get { return new BookListViewSchema(); }
}
// Allow getting the record count
public override bool CanRetrieveTotalRowCount
{
get { return true; }
}
// Do not allow deletions
public override bool CanDelete
{
get { return false; }
}
// Do not allow insertions
public override bool CanInsert
{
get { return false; }
}
// Do not allow updates
public override bool CanUpdate
{
get { return false; }
}
// Do not allow paging
public override bool CanPage
{
get { return false; }
}
// Do not allow sorting
public override bool CanSort
{
get { return false; }
}
}
示例2: BookListViewSchema
// A custom View Schema class
public class BookListViewSchema : IDataSourceViewSchema
{
public BookListViewSchema()
{ }
// The name of this View Schema
public string Name
{
get { return "BookList"; }
}
// Build a Field Schema array
public IDataSourceFieldSchema[] GetFields()
{
IDataSourceFieldSchema[] fields = new IDataSourceFieldSchema[2];
fields[0] = new CustomIDFieldSchema();
fields[1] = new CustomTitleFieldSchema();
return fields;
}
// There are no child views, so return null
public IDataSourceViewSchema[] GetChildren()
{
return null;
}
}
// A custom Field Schema class for ID
public class CustomIDFieldSchema : IDataSourceFieldSchema
{
public CustomIDFieldSchema()
{ }
// Name is ID
public string Name
{
get { return "ID"; }
}
// Data type is string
public Type DataType
{
get { return typeof(string); }
}
// This is not an Identity field
public bool Identity
{
get { return false; }
}
// This field is read only
public bool IsReadOnly
{
get { return true; }
}
// This field is unique
public bool IsUnique
{
get { return true; }
}
// This field can't be longer than 20
public int Length
{
get { return 20; }
}
// This field can't be null
public bool Nullable
{
get { return false; }
}
// This is a Primary Key
public bool PrimaryKey
{
get { return true; }
}
// These properties do not apply
public int Precision
{
get { return -1; }
}
public int Scale
{
get { return -1; }
}
}
// A custom Field Schema class for Title
public class CustomTitleFieldSchema : IDataSourceFieldSchema
{
public CustomTitleFieldSchema()
{ }
// Name is Title
public string Name
{
get { return "Title"; }
}
// Type is string
public Type DataType
{
get { return typeof(string); }
}
// This is not an Identity field
public bool Identity
{
get { return false; }
}
// This field is not read only
public bool IsReadOnly
{
get { return false; }
}
// This field is not unique
public bool IsUnique
{
get { return false; }
}
// This field can't be longer than 100
public int Length
{
get { return 100; }
}
// This field can't be null
public bool Nullable
{
get { return false; }
}
// This is not the Primary Key
public bool PrimaryKey
{
get { return false; }
}
// These properties do not apply
public int Precision
{
get { return -1; }
}
public int Scale
{
get { return -1; }
}
}