<
TABLE
>
< tr >
< td >< INPUT type ="radio" value ="A" name ="Question" > <% = ViewState[ " A " ] %> </ td >
</ tr >
< tr >
< td height ="15" ></ td >
</ tr >
< tr >
< td >< INPUT type ="radio" value ="B" name ="Question" > <% = ViewState[ " B " ] %> </ td >
</ tr >
< tr >
< td height ="15" ></ td >
</ tr >
< tr >
< td >< INPUT type ="radio" value ="C" name ="Question" > <% = ViewState[ " C " ] %> </ td >
</ tr >
< tr >
< td height ="15" ></ td >
</ tr >
< tr >
< td >< INPUT type ="radio" value ="D" name ="Question" > <% = ViewState[ " D " ] %> </ td >
</ tr >
</ TABLE >
< tr >
< td >< INPUT type ="radio" value ="A" name ="Question" > <% = ViewState[ " A " ] %> </ td >
</ tr >
< tr >
< td height ="15" ></ td >
</ tr >
< tr >
< td >< INPUT type ="radio" value ="B" name ="Question" > <% = ViewState[ " B " ] %> </ td >
</ tr >
< tr >
< td height ="15" ></ td >
</ tr >
< tr >
< td >< INPUT type ="radio" value ="C" name ="Question" > <% = ViewState[ " C " ] %> </ td >
</ tr >
< tr >
< td height ="15" ></ td >
</ tr >
< tr >
< td >< INPUT type ="radio" value ="D" name ="Question" > <% = ViewState[ " D " ] %> </ td >
</ tr >
</ TABLE >
private
void
btnOk_Click(
object
sender, System.EventArgs e)
... {
if(Request["Question"]==null) //判断是否有选项
...{
lblLitter.Text = "<script>alert('请选择!');</script>";
}
else
...{
//Answer:答案 A,B,C,D
Answer=ViewState["Answer"].ToString().Trim();
if(ViewState["Answer"].ToString().Trim()==Request["Question"].ToString().Trim())
...{
lblLitter.Text = "<script>alert('回答正确!');</script>";
}
else
...{
lblLitter.Text = "<script>alert('回答错误!');</script>";
}
}
}
... {
if(Request["Question"]==null) //判断是否有选项
...{
lblLitter.Text = "<script>alert('请选择!');</script>";
}
else
...{
//Answer:答案 A,B,C,D
Answer=ViewState["Answer"].ToString().Trim();
if(ViewState["Answer"].ToString().Trim()==Request["Question"].ToString().Trim())
...{
lblLitter.Text = "<script>alert('回答正确!');</script>";
}
else
...{
lblLitter.Text = "<script>alert('回答错误!');</script>";
}
}
}
Request["Question"]:得到的是radio 的Value值