我有100个用excel编写的问题。我得到所有数据,如问题nr。,问题文本,选项A,B,C和D.我成功地得到了问题nr。和文本,但我运行我的项目时只创建一个单选按钮。我想为每个问题生成4个单选按钮。怎么样?请帮帮我
注意:dt是我已经普及的数据表
**CODE**
private void ShowQuestions(DataTable dt)
{
int i = 0;
int j = 0;
Label[] lblQNo = new Label[dt.Rows.Count];
Label[] lblQText= new Label[dt.Rows.Count];
RadioButton[] rbs = new RadioButton[4*dt.Rows.Count];
for (i = 0; i < dt.Rows.Count; i++)
{
lblQText[i] = new Label();
lblQText[i].Text = "<h3>"+dt.Rows[i]["SrNo"].ToString()+"<h3>"+dt.Rows[i]["QuestionText"].ToString()+"</h3><br>";
for (j = 3; j < 7; j++)
{
rbs[i] = new RadioButton();
rbs[i].Text = dt.Rows[i][j].ToString();
rbs[i].GroupName = i.ToString();
divQuestionText.Controls.Add(rbs[i]);
}
divQuestionText.Controls.Add(lblQText[i]);
}
HTML
<div class="form-horizontal">
<div class="row" runat="server">
<div class="col-sm-12" id="divQuestionText" runat="server">
</div>
</div>
</div>