GrapeCity MultiRow Windows Forms Documentation
DataField Property
Example 


Gets or sets the name of the data source field to which the Cell is bound.
Syntax
<TypeConverterAttribute("GrapeCity.Win.MultiRow.Design.DataFieldConverter,GrapeCity.Win.MultiRow.Design, Version=7.20.20141.0, Culture=neutral, PublicKeyToken=0f7a722ee3c2bdd9")>
<EditorAttribute(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="GrapeCity.Win.MultiRow.Design.DataFieldEditor,GrapeCity.Win.MultiRow.Design, Version=7.20.20141.0, Culture=neutral, PublicKeyToken=0f7a722ee3c2bdd9")>
<SRCategoryAttribute("Data")>
<SRDescriptionAttribute("Indicates the name of the data source field to which the Cell is bound.")>
Public Property DataField As String
Dim instance As Cell
Dim value As String
 
instance.DataField = value
 
value = instance.DataField
[TypeConverter("GrapeCity.Win.MultiRow.Design.DataFieldConverter,GrapeCity.Win.MultiRow.Design, Version=7.20.20141.0, Culture=neutral, PublicKeyToken=0f7a722ee3c2bdd9")]
[Editor(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="GrapeCity.Win.MultiRow.Design.DataFieldEditor,GrapeCity.Win.MultiRow.Design, Version=7.20.20141.0, Culture=neutral, PublicKeyToken=0f7a722ee3c2bdd9")]
[SRCategory("Data")]
[SRDescription("Indicates the name of the data source field to which the Cell is bound.")]
public string DataField {get; set;}

Property Value

A System.String value that represents the name of the data source field associated with the cell. The default is String.Empty.
Remarks
If you want to bind a data source to the GcMultiRow control, set the data source column name to this property first when creating a Template. After you set the data source to GcMultiRow's GcMultiRow.DataSource, this cell displays the contents whose owning column's name in the data source is the DataField property value.
Example
The following code example shows how to use this property to bind to a specific column in the data source. This code example is part of a larger example provided for the GcMultiRow.DataSource property.
Template CreateDataBindingTamplate()
        {
            TextBoxCell idCell = new TextBoxCell();

            // Binding a data source column.
            // The DataField should be equal to a column name in the data source. 
            idCell.DataField = "ID";

            TextBoxCell nameCell = new TextBoxCell();
            nameCell.DataField = "Name";

            CheckBoxCell genderCell = new CheckBoxCell();
            genderCell.DataField = "Gender";

            Cell[] cells = new Cell[] { idCell, nameCell, genderCell };

            return Template.CreateGridTemplate(cells);
        }
Private Function CreateDataBindingTamplate() As Template
        Dim idCell As New TextBoxCell()

        ' Binding a column of data source.
        ' The DataField property should be equal to a column name in the data  source. 
        idCell.DataField = "ID"

        Dim nameCell As New TextBoxCell()
        nameCell.DataField = "Name"

        Dim genderCell As New CheckBoxCell()
        genderCell.DataField = "Sex"

        Dim cells As Cell() = New Cell() {idCell, nameCell, genderCell}

        Return Template.CreateGridTemplate(cells)
    End Function
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

Cell Class
Cell Members

 

 


Copyright © GrapeCity, inc. All rights reserved.