Hi Everyone,
I am trying to dynamically create a table with radiobuttons, textboxes and buttons on each rows uniquely depending on the question to the left of the TableRow with two TableCells.
So far, I was able to add the questions to the left of the TableRow. Now, I am having a hard time filling out the right side of it.
Can someone help me. Thanks.
I have the following code below:
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);
}