Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

DataGridColumnStyle.MappingName Property

Gets or sets the name of the data member to map the column style to.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

[LocalizableAttribute(true)] 
public string MappingName { get; set; }
/** @property */
public String get_MappingName ()

/** @property */
public void set_MappingName (String value)

public function get MappingName () : String

public function set MappingName (value : String)

Not applicable.

Property Value

The name of the data member to map the column style to.

The comparison used to match the MappingName to the data member is case-insensitive.

This DataGridColumnStyle is used to render the data in the indicated data member whenever the data source matches the one indicated by the MappingName property of the DataGridTableStyle that contains this column style.

The DataGridColumnStyle.MappingName property is usually set to the ColumnName of a DataColumn.

The following code example creates a DataGridTableStyle, and adds two DataGridColumnStyle objects to the GridColumnStylesCollection. The MappingName for each DataGridColumnStyle is set to the ColumnName of a DataColumn.

private void AddDataGridTableStyle()
{
   // Create a new DataGridTableStyle and set MappingName.
   DataGridTableStyle myGridStyle = 
   new DataGridTableStyle();
   myGridStyle.MappingName = "Customers";

   // Create two DataGridColumnStyle objects.
   DataGridColumnStyle colStyle1 =
   new DataGridTextBoxColumn();
   colStyle1.MappingName = "firstName";
   
   DataGridColumnStyle colStyle2 =
   new DataGridBoolColumn();
   colStyle2.MappingName = "Current";

   // Add column styles to table style.
   myGridStyle.GridColumnStyles.Add(colStyle1);
   myGridStyle.GridColumnStyles.Add(colStyle2);   

   // Add the grid style to the GridStylesCollection.
   myDataGrid.TableStyles.Add(myGridStyle);
}

private void AddDataGridTableStyle()
{
    // Create a new DataGridTableStyle and set MappingName.
    DataGridTableStyle myGridStyle = new DataGridTableStyle();
    myGridStyle.set_MappingName("Customers");

    // Create two DataGridColumnStyle objects.
    DataGridColumnStyle colStyle1 = new DataGridTextBoxColumn();
    colStyle1.set_MappingName("firstName");

    DataGridColumnStyle colStyle2 = new DataGridBoolColumn();
    colStyle2.set_MappingName("Current");

    // Add column styles to table style.
    myGridStyle.get_GridColumnStyles().Add(colStyle1);
    myGridStyle.get_GridColumnStyles().Add(colStyle2);

    // Add the grid style to the GridStylesCollection.
    myDataGrid.get_TableStyles().Add(myGridStyle);
} //AddDataGridTableStyle

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions

Show:
© 2014 Microsoft