IHierarchicalList interface, required to support hierarchichal objects binding in WebGrid.NET Enterprise V4.0.
Syntax
| Visual Basic (Declaration) | |
|---|
Public Interface IHierarchicalList |
| C# | |
|---|
public interface IHierarchicalList |
| Delphi | |
|---|
public interface IHierarchicalList |
| JScript | |
|---|
public interface IHierarchicalList |
| Managed Extensions for C++ | |
|---|
public __gc __interface IHierarchicalList |
| C++/CLI | |
|---|
public interface class IHierarchicalList |
Example
The following is sample code for IHierarchicalList Implementation for Flat Collection.
| C# | Copy Code |
|---|
public class CustomerCollection : System.Collections.CollectionBase, IHierarchicalList
{
public void Add(Customer aCustomer)
{
aCustomer.Owner = this;
List.Add(aCustomer);
}
public bool Remove(int index)
{
// Check to see if there is a customer at the supplied index.
if (index > Count - 1 || index < 0)
{
return false;
}
else
{
List.RemoveAt(index);
return true;
}
}
public void Remove(Customer cust)
{
List.Remove(cust);
}
public Customer Item(int Index)
{
return (Customer) List[Index];
}
public Customer FindByID(string customerID)
{
foreach (Customer c in this.InnerList)
{
if (c.CustomerID == customerID) return c;
}
return null;
}
#region IHierarchicalList Members
public Type ItemType
{
get
{
return typeof(Customer);
}
}
#endregion
} |
The following is sample code for data binding.
| C# | Copy Code |
|---|
private void WebGrid1_InitializeDataSource(object sender,
ISNet.WebUI.WebGrid.DataSourceEventArgs e)
{
CustomerCollection customers = DataLayer.GetCustomers();
// populate order to all customers
foreach (Customer cust in customers)
{
cust.PopulateOrders();
}
e.DataSource = customers;
} |
Remarks
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