السلام عليكم ورحمة الله وبركات
وفققكم الله الي كل الجنة
كيف يمكن حصر اختيارات المستخدم
oleDbDApQuestion.Fill(dataSet11.pQuestion);
oleDbDAtAnswer.Fill(dataSet11.tAnswer);
ListBox1.DataBind();
ListBox2.DataBind();
try
{
for(int nQuestion=1;nQuestion<dataSet11.pQuestion.Rows.Count+1;nQuestion++)
{
Label labQ =new Label();
string sConNameQ="labQ"+nQuestion;
labQ.ID=sConNameQ;
ListBox1.SelectedIndex=nQuestion-1;
ListBox2.SelectedIndex=nQuestion-1;
labQ.Text=ListBox1.SelectedItem.Text.ToString();
labQ.BackColor=System.Drawing.Color.Cyan;
Panel1.Controls.Add(labQ);
dataView2.RowFilter="nQuestionCode="+nQuestion;
if(ListBox2.SelectedItem.Text=="S")
{
RadioButtonList RadioButtonListA=new RadioButtonList();
RadioButtonListA.ID="RadioButtonListA"+nQuestion;
RadioButtonListA.DataSource =dataView2;
RadioButtonListA.DataTextField="sAnswerTxt";
RadioButtonListA.DataValueField="nQuestionCode";
RadioButtonListA.DataBind();
Panel1.Controls.Add(RadioButtonListA);
}
else
{
CheckBoxList CheckBoxListA=new CheckBoxList();
CheckBoxListA.ID="CheckBoxListA"+nQuestion;
CheckBoxListA.DataSource =dataView2;
CheckBoxListA.DataTextField="sAnswerTxt";
CheckBoxListA.DataValueField="nQuestionCode";
CheckBoxListA.DataBind();
Panel1.Controls.Add(CheckBoxListA);
}
////////////////////////
private void GetVal_Click(object sender, System.EventArgs e)
{
RadioButtonList l;
l = (RadioButtonList) Panel1.FindControl("RadioButtonListA1");
Button1.Text=l.SelectedItem.Value.ToString();
}