public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex)
{
base.InitializeCell(cell, cellType, rowState, rowIndex);
switch (rowState)
{
case DataControlRowState.Edit:
case DataControlRowState.Normal:
case DataControlRowState.Alternate:
case DataControlRowState.Selected:
if (SelectionMode == ListSelectionMode.Multiple)
{
ParticipantCheckBox selector = new ParticipantCheckBox();
selector.ID = "RowSelectorColumnSelector";
selector.AutoPostBack = AutoPostBack;
cell.Controls.Add(selector);
if (AllowSelectAll)
{
RegisterForSelectAll(selector);
}
selector.ServerChange += new EventHandler(selector_ServerChange);
}
else
{
ParticipantRadioButton selector = new ParticipantRadioButton();
selector.Name = "RowSelectorColumnSelector";
selector.ID = "RowSelectorColumnSelector";
selector.AutoPostBack = AutoPostBack;
cell.Controls.Add(selector);
selector.DataBinding += new EventHandler(selectorDataBinding);
selector.ServerChange += new EventHandler(selector_ServerChange);
}
break;
}
if (cellType == DataControlCellType.Header)
{
if (AllowSelectAll && SelectionMode == ListSelectionMode.Multiple)
{
selectAllControl = new SelectAllCheckBox();
selectAllControl.ID = "RowSelectorColumnAllSelector";
selectAllControl.AutoPostBack = AutoPostBack;
RegisterSelectAllScript();
String currentText = (cell == null) ? "" : cell.Text;
if (!string.IsNullOrEmpty(currentText))
{
cell.Text = "";
}
cell.Controls.Add(selectAllControl);
if (!string.IsNullOrEmpty(currentText))
{
cell.Controls.Add(new LiteralControl(currentText));
}
}
}
}