我正在尝试根据带有两个 TableCell 的 TableRow 左侧的问题,在每行上动态创建一个带有单选按钮、文本框和按钮的表格。
到目前为止,我能够将问题添加到 TableRow 的左侧。现在,我很难填写它的右侧。
有人能帮我吗?
我有以下代码:
private void DesignQuestionnaire(string[] questionList, Label question, RadioButtonList answerChoices, RadioButton choices, TextBox textAnswer, Button save, Button cancel)
{
Table formTable = new Table();
TableRow formRow;
TableCell formCell;
for (int row = 0; row < questionList.Length; row++ )
{
formRow = new TableRow();
formTable.Rows.Add(formRow);
for (int col = 0; col < 2; col++ )
{
formCell = new TableCell();
//formCell.Attributes.CssStyle.Add("border", "solid");
if (col == 1)
{
formCell.ID = "A" + row.ToString();
formCell.Controls.Add(choices);
}
else
{
formCell.ID = "Q" + row.ToString();
formCell.Text = questionList.GetValue(row).ToString();
}
formRow.Cells.Add(formCell);
}
}
Controls.Add(formTable);
}