Intersoft WebGrid Documentation
DataMember Property
See Also  Example Send Feedback
ISNet.WebUI.WebGrid Namespace > WebGrid Class : DataMember Property






Gets or sets the name of table for which WebGrid control display its data.

Syntax

Visual Basic (Declaration) 
<ISNet.Serialization.BinarySerializableAttribute()>
<ISNet.PersistLayoutAttribute(False)>
<DescriptionAttribute("Gets or sets the datamember of the grid.")>
<NotifyParentPropertyAttribute(True)>
<DefaultValueAttribute()>
<CategoryAttribute("Data")>
Public Property DataMember As String
Visual Basic (Usage)Copy Code
Dim instance As WebGrid
Dim value As String
 
instance.DataMember = value
 
value = instance.DataMember
C# 
[ISNet.Serialization.BinarySerializableAttribute()]
[ISNet.PersistLayoutAttribute(false)]
[DescriptionAttribute("Gets or sets the datamember of the grid.")]
[NotifyParentPropertyAttribute(true)]
[DefaultValueAttribute()]
[CategoryAttribute("Data")]
public string DataMember {get; set;}
Delphi 
public read-write property DataMember: String; 
JScript 
ISNet.Serialization.BinarySerializableAttribute()
ISNet.PersistLayoutAttribute()
DescriptionAttribute("Gets or sets the datamember of the grid.")
NotifyParentPropertyAttribute()
DefaultValueAttribute()
CategoryAttribute("Data")
public function get,set DataMember : String
Managed Extensions for C++ 
[ISNet.Serialization.BinarySerializableAttribute()]
[ISNet.PersistLayoutAttribute(false)]
[DescriptionAttribute("Gets or sets the datamember of the grid.")]
[NotifyParentPropertyAttribute(true)]
[DefaultValueAttribute()]
[CategoryAttribute("Data")]
public: __property string* get_DataMember();
public: __property void set_DataMember( 
   string* value
);
C++/CLI 
[ISNet.Serialization.BinarySerializableAttribute()]
[ISNet.PersistLayoutAttribute(false)]
[DescriptionAttribute("Gets or sets the datamember of the grid.")]
[NotifyParentPropertyAttribute(true)]
[DefaultValueAttribute()]
[CategoryAttribute("Data")]
public:
property String^ DataMember {
   String^ get();
   void set (    String^ value);
}

Example

The following sample codes show you how to perform physical update on a database (DataMember = Customer Table) programatically.
C#Copy Code
private void WebGrid1_InitializeDataSource(object sender,
ISNet.WebUI.WebGrid.DataSourceEventArgs e)
{
     oleDbDataAdapter1.Fill(dsNorthWindEnt1.Customers);   

     e.DataSource = dsNorthWindEnt1;
}

private void WebGrid1_UpdateRow(object sender,
ISNet.WebUI.WebGrid.RowEventArgs e)
{
    DataSet ds = (DataSet)WebGrid1.DataSource;
    if (e.Row.Table.DataMember == "Customers") 
    {
            // updated row is for Customers table.
            // use proper dataadapter and call Update.
           oleDbDataAdapter1.Update(ds.Tables["Customers"]); 

     }

     else

    {

          oleDbDataAdapter2.Update(ds.Tables["Orders"]);
    }
}

Remarks

In order to bind WebGrid, users can configure DataMember property using WebGrid.Net Designer after they have configured the DataSource or generated the DataSet. The DataMember property should be filled with the name of table that users wanto to display (for instance, "Customer"), then then by invoking 'Retrieve Hierarchical Structure', the grid will automatically create WebGridTable object for table.  

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

©2012 Intersoft Solutions Corp. All Rights Reserved.