我想显示如下格式的单选框,如:
1、 题目
a、234
b、344
c、3434
答案:在这里显示单选框
2、 题目
a、234
b、344
c、3434
答案:在这里显示单选框可是我做的这个程序
却没有循环,显示了如下各式的内容1、 题目
a、234
b、344
c、3434
答案:
2、 题目
a、234
b、344
c、3434
答案:在这里显示单选框
1、 题目
a、234
b、344
c、3434
答案:在这里显示单选框
2、 题目
a、234
b、344
c、3434
答案:在这里显示单选框可是我做的这个程序
却没有循环,显示了如下各式的内容1、 题目
a、234
b、344
c、3434
答案:
2、 题目
a、234
b、344
c、3434
答案:在这里显示单选框
System.Data.SqlClient.SqlConnection con1=new SqlConnection(Session["cn"].ToString());
con1.Open();
string sqlc="select max(shijuanhao) from NeiCeShiJuan";
num=Base.ExecuteSql4Value(sqlc);
int []nm=new int[4];
string sqla="select tihao from NeiCeShiJuan where shijuanhao='"+num+"'";
System.Data.SqlClient.SqlCommand cmd=new SqlCommand(sqla,con);
System.Data.SqlClient.SqlDataReader dr1=cmd.ExecuteReader();
mystr1 +="<h1 align=center valign=buttom>"+Session["kemu"]+"内测题</h1 ><br><hr>";
str0+="<hr>";
btnsubmit=new Button();
btnexit=new Button();
btnsubmit.Text="提交";
btnexit.Text="取消";
while(dr1.Read())
{
sqlb="select * from NeiCeTiKu where tihao='"+Convert.ToInt32(dr1["tihao"])+"'";
//当NeiCeTiKu tihao=NeiCeShiJuan 中的tihao时把其他这个题号相关的内容显示出来
System.Data.SqlClient.SqlCommand cmd1=new SqlCommand(sqlb,con1);
SqlDataReader dr=cmd1.ExecuteReader();
while(dr.Read())
{
if(dr["leixing"].ToString()=="r")
{
typestr="单选";
}
else
{
typestr="多选";
}
subject=dr["kemu"].ToString();
mystr +=j.ToString()+" " + dr["neirong"] +" "+typestr + "<br>";
mystr +="A  " + dr["xuanxiangA"].ToString() +"<br> B  "+ dr["xuanxiangB"].ToString()+"<br> C  " +dr["xuanxiangC"].ToString() +"<br> D  " +dr["xuanxiangD"].ToString()+"<br> E  " +dr["xuanxiangE"].ToString()+"<br>";
mystr+="<br>答案<br>";
label1.Text=mystr1;
mylabel.Text=mystr;
cell.Controls.Add(label1);
cell.Controls.Add(mylabel);
if (dr["leixing"].ToString()=="r")
{
RadioButtonList radio=new RadioButtonList();
radio.RepeatDirection=RepeatDirection.Horizontal;
radio.ID="mycontrol"+ j.ToString();
radio.Items.Add("A");
radio.Items.Add("B");
radio.Items.Add("C");
radio.Items.Add("D");
radio.Items.Add("E");
cell.Controls.Add(radio);//单选的选项ABCDE
}
else
{
CheckBoxList check =new CheckBoxList();
check.RepeatDirection=RepeatDirection.Horizontal;
check.ID="mycontrol" +j.ToString();
check.Items.Add("A");
check.Items.Add("B");
check.Items.Add("C");
check.Items.Add("D");
check.Items.Add("E");
cell.Controls.Add(check);//复选的选项ABCDE
}
label0.Text=str0;
cell.Controls.Add(label0);
cell.Controls.Add(btnsubmit);
this.btnsubmit.Click+=new System.EventHandler(this.btnsubmit_Click);
cell.Controls.Add(btnexit);
row.Cells.Add(cell);
Table1.Rows.Add(row);
j+=1;
}
没看出来它是一个什么控件