AutoGeneratedField.DataType プロパティ
アセンブリ: System.Web (system.web.dll 内)

Dim instance As AutoGeneratedField Dim value As Type value = instance.DataType instance.DataType = value
AutoGeneratedField オブジェクトに表示される値のデータ型を表す Type。既定値は String です。

DataType プロパティを使用して、AutoGeneratedField オブジェクトに表示される値のデータ型を指定します。このデータ型により、値を表示する AutoGeneratedField オブジェクトに表示されるコントロールの種類が決まります。たとえば、型が Boolean の場合は、チェック ボックス コントロールが表示されます。

DataType プロパティを使用して、プログラムによって、DetailsView コントロールから派生したカスタム コントロールに AutoGeneratedField オブジェクトを作成する場合に、フィールドのデータ型を指定する方法を次の例に示します。
Imports System.ComponentModel Imports System.Web.UI Imports System.Web.UI.WebControls Imports System.Security.Permissions Imports System.Web Namespace Samples.AspNet.VB.Controls <AspNetHostingPermission(SecurityAction.Demand, Level:=AspNetHostingPermissionLevel.Minimal), AspNetHostingPermission(SecurityAction.InheritanceDemand, Level:=AspNetHostingPermissionLevel.Minimal)> Public Class SimpleCustomControl Inherits System.Web.UI.WebControls.DetailsView Protected Overrides Function CreateAutoGeneratedRow(ByVal fieldProperties As AutoGeneratedFieldProperties) As AutoGeneratedField ' Create an AutoGeneratedField object. Dim field As New AutoGeneratedField(fieldProperties.DataField) ' Set the properties of the AutoGeneratedField using ' the values from the AutoGeneratedFieldProperties ' object contained in the fieldProperties parameter. CType(field, IStateManager).TrackViewState() field.HeaderText = fieldProperties.Name field.SortExpression = fieldProperties.Name field.ReadOnly = fieldProperties.IsReadOnly field.DataType = fieldProperties.Type Return field End Function End Class End Namespace
using System; using System.Collections.Generic; using System.ComponentModel; using System.Text; using System.Web.UI; using System.Web.UI.WebControls; using System.Security.Permissions; using System.Web; namespace Samples.AspNet.CS.Controls { [AspNetHostingPermission(SecurityAction.Demand, Level=AspNetHostingPermissionLevel.Minimal)] [AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)] public class SimpleCustomControl : DetailsView { protected override AutoGeneratedField CreateAutoGeneratedRow(AutoGeneratedFieldProperties fieldProperties) { // Create an AutoGeneratedField object. AutoGeneratedField field = new AutoGeneratedField(fieldProperties.DataField); // Set the properties of the AutoGeneratedField using // the values from the AutoGeneratedFieldProperties // object contained in the fieldProperties parameter. ((IStateManager)field).TrackViewState(); field.HeaderText = fieldProperties.Name; field.SortExpression = fieldProperties.Name; field.ReadOnly = fieldProperties.IsReadOnly; field.DataType = fieldProperties.Type; return field; } } }

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からAutoGeneratedField.DataType プロパティを検索する場合は、下記のリンクをクリックしてください。

- AutoGeneratedField.DataType プロパティのページへのリンク