Tuesday, July 3, 2007

Assigning Header to Infragistics grid

private void ApplyStylesToGrid()
{
// In 2.0
dgSample.DisplayLayout.Bands[0].Columns[0].Header.Caption = "Customer Id";
dgSample.DisplayLayout.Bands[0].Columns[1].Header.Caption = "Customer Name";
dgSample.DisplayLayout.Bands[1].Columns[0].Header.Caption = "Order Id";
dgSample.DisplayLayout.Bands[1].Columns[1].Header.Caption = "Customer Id";
dgSample.DisplayLayout.Bands[1].Columns[2].Header.Caption = "Order Date";
// In 1.1
//dgSample.DisplayLayout.Bands[0].Columns[0].HeaderText = "Customer Id";
//dgSample.DisplayLayout.Bands[0].Columns[1].HeaderText = "Customer Name";
//dgSample.DisplayLayout.Bands[1].Columns[0].HeaderText = "Order Id";
//dgSample.DisplayLayout.Bands[1].Columns[1].HeaderText = "Customer Id";
//dgSample.DisplayLayout.Bands[1].Columns[2].HeaderText = "Order Date";
}
protected void dgSample_ExpandRow(object sender, RowEventArgs e)
{
dgSample.ExpandAll(false);
e.Row.Expand(true);
}

No comments: