sfDataGrid1.AutoGenerateColumns = false;
sfDataGrid1.DataSource = GetCollection();
sfDataGrid1.Columns.Add(new GridNumericColumn() { MappingName = "ProductID" });
sfDataGrid1.Columns.Add(new GridTextColumn() { MappingName = "ProductName" });
sfDataGrid1.Columns.Add(new GridTextColumn() { MappingName = "Category.CategoryName" });
sfDataGrid1.Columns.Add(new GridNumericColumn() { MappingName = "UnitPrice" });
sfDataGrid1.Columns.Add(new GridTextColumn() { MappingName = "Status" }); |
sfDataGrid1.AutoGenerateColumnsForCustomType = true;
public class Category
{
[Bindable(false)]
public int CategoryID { get; set; }
[Display(Name = " CategoryName ", Order = 0)]
public string CategoryName { get; set; }
public IList<Product> Products { get; set; }
} |