GrapeCity MultiRow Windows Forms Documentation
DataMember Property
Example 


Gets or sets the name of the list or table in the data source for which the GcMultiRow control displays data.
Syntax
<SRDescriptionAttribute("Indicates a sub-list of the DataSource to show in the GcMultiRow control.")>
<FeatureAttribute(Name="DataBinding", Version="v5.0")>
<DefaultValueAttribute()>
<SRCategoryAttribute("Data")>
<EditorAttribute(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="System.Windows.Forms.Design.DataMemberListEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")>
Public Property DataMember As String
Dim instance As GcMultiRow
Dim value As String
 
instance.DataMember = value
 
value = instance.DataMember
[SRDescription("Indicates a sub-list of the DataSource to show in the GcMultiRow control.")]
[Feature(Name="DataBinding", Version="v5.0")]
[DefaultValue()]
[SRCategory("Data")]
[Editor(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="System.Windows.Forms.Design.DataMemberListEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public string DataMember {get; set;}

Property Value

A System.String that represents the name of the table or list in the DataSource for which the GcMultiRow control displays data. The default is String.Empty.
Exceptions
ExceptionDescription
System.ExceptionAn error occurred in the data source and either there is no handler for the DataError event or the handler has set the ThrowException property to true.
System.ArgumentExceptionThe specified value is not a valid member in the DataSource.
Remarks
This property is useful when binding to a data source that contains multiple lists or tables. You do not need to set this property when binding to a data source that contains a single list or table. For example, you can bind a GcMultiRow control to a System.Data.DataSet that contains a single table without setting this property. If the System.Data.DataSet contains multiple tables; however, you must set this property to the name of one of the tables.
Example
The following code example shows how to use this property to bind one table in a multiple table data source. This code example is part of a larger example provided for the DataSource property.
private void Form1_Load(object sender, EventArgs e)
        {
            InitializeDataSource();

            // The following code can be used instead:
            // this.gcMultiRow1.DataSource = studentInfoDataSet.Tables["BasicInfos"];
            this.gcMultiRow1.DataSource = studentInfoDataSet;
            this.gcMultiRow1.DataMember = "BasicInfos";

            // When data binding, the cells in the template should set the DataField property to bind a specific column of the data source.
            this.gcMultiRow1.Template = this.CreateDataBindingTamplate();

            this.gcMultiRow1.DataError += new EventHandler<DataErrorEventArgs>(gcMultiRow1_DataError);
        }
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        InitializeDataSource()

        ' The following code can be used instead:
        ' this.gcMultiRow1.DataSource = studentInfoDataSet.Tables["BasicInfos"];
        Me.gcMultiRow1.DataSource = studentInfoDataSet
        Me.gcMultiRow1.DataMember = "BasicInfos"

        ' When data binding, the cells in the template should set the DataField property to bind a specific column of the data source.
        Me.gcMultiRow1.Template = Me.CreateDataBindingTamplate()
    End Sub
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

GcMultiRow Class
GcMultiRow Members
DataSource Property
DataField Property

 

 


Copyright © GrapeCity, inc. All rights reserved.