private void SetupCalendarItem(TableCell cell, DataRow r, ITemplate t) { // given a calendar cell and a datarow, set up the // templated item and resolve data binding syntax // in the template DataCalendarItem dti = new DataCalendarItem(r); t.InstantiateIn(dti); dti.DataBind(); cell.Controls.Add(dti); }