2 つの TableCells を持つ 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);
}