0
我正在嘗試將單選按鈕添加到我的表中。C#RadioButtonList into TableCells
問題是,我使用RadioButtonList來保存無線電和ListItem不能被添加到單元出於某種原因?是我的代碼完全或有另一種方式來處理.net中的這個?
private TableRow generateCells(String domainName)
{
TableRow row = new TableRow();
Label dName = new Label();
dName.Text = domainName;
RadioButtonList radioList = new RadioButtonList();
ListItem sunriseA = new ListItem();
sunriseA.Value = Price_Types.SUNRISE_ONE.ToString();
radioList.Items.Add(sunriseA);
ListItem sunriseB = new ListItem();
sunriseB.Value = Price_Types.SUNRISE_TWO.ToString();
radioList.Items.Add(sunriseB);
ListItem landrush = new ListItem();
landrush.Value = Price_Types.LANDRUSH.ToString();
radioList.Items.Add(landrush);
ListItem general = new ListItem();
general.Value = Price_Types.GENERAL.ToString();
radioList.Items.Add(general);
row.Cells.Add(addCell(dName));
// this is not working
row.Cells.Add(addCell(sunriseA));
row.Cells.Add(addCell(sunriseB));
row.Cells.Add(addCell(landrush));
row.Cells.Add(addCell(general));
return row;
}
private TableCell addCell(Control c)
{
TableCell cell = new TableCell();
cell.Controls.Add(c);
return cell;
}