Although it has no obvious impact, I’ve had to repeatedly break the design guidelines rule of not calling virtual members in the constructor when working with subclassed datagrids.

public class MyDataGrid : DataGrid
{
 public MyDataGrid
 {
  ShowFooter = true;
 }
}

This throws up the warning Virtual member call in constructor.  To get around this, I’ve tried moving the call to the OnInit method:

public class MyDataGrid : DataGrid
{
 protected override void OnInit(System.EventArgs e)
 {
  base.OnInit(e);
  ShowFooter = true;
 }
}

This works and gets rid of the error, but removes the ability to change the ShowFooter setting from the datagrid tag on the aspx page (as when OnInit fires, it overwrites the value specified in the datagrid tag on the aspx page).

Maybe I’m missing something, but does anyone know a way around this (ie. setting datagrid properties programatically in a subclassed datagrid, without violating the virtual member call in constructor rule, whilst still allowing the setting to be changed from the datagrid tag on the aspx page) ?