问题描述
其中有单选多选和简答,题目和选项是从后台添加的。如何把多选正确选项提交到数据库,并且读取出来再处于选中状态呢?
解决方案
解决方案二:
读出后台数据,然后代码创建控件填充数据就行了。
解决方案三:
引用1楼lyxxly的回复:
读出后台数据,然后代码创建控件填充数据就行了。
怎么填充数据呢
解决方案四:
好好看看Form表单的知识页面生成<inputname="Color"value="">后台接受Request.Param["Color"]
解决方案五:
引用3楼moonwrite的回复:
好好看看Form表单的知识页面生成<inputname="Color"value="">后台接受Request.Param["Color"]
我前端都是循环出来的,这样接收到的值没办法分离是第几题的
解决方案六:
引用3楼moonwrite的回复:
好好看看Form表单的知识页面生成<inputname="Color"value="">后台接受Request.Param["Color"]
@{IList<TB_Pro>list=(IList<TB_Pro>)ViewData["news"];}@foreach(variteminlist){if(item.Class==1){<divclass="titlemt35c5">Q1:@item.Title</div>if(item.Class2==2){<divclass="title1pl30">@Html.RadioButton("radioitem","A",new{style="margin-right:7px;"})@Html.Raw(item.Image)</div><divclass="title1pl30">@Html.RadioButton("radioitem","B",new{style="margin-right:7px;"})@Html.Raw(item.Image2)</div>}if(item.Class2==3){<divclass="title1pl30">@Html.RadioButton("radioitem","A",new{style="margin-right:7px;"})@Html.Raw(item.Image)</div><divclass="title1pl30">@Html.RadioButton("radioitem","B",new{style="margin-right:7px;"})@Html.Raw(item.Image2)</div><divclass="title1pl30">@Html.RadioButton("radioitem","C",new{style="margin-right:7px;"})@Html.Raw(item.Image3)</div>}if(item.Class2==4){<divclass="title1pl30">@Html.RadioButton("radioitem","A",new{style="margin-right:7px;"})@Html.Raw(item.Image)</div><divclass="title1pl30">@Html.RadioButton("radioitem","B",new{style="margin-right:7px;"})@Html.Raw(item.Image2)</div><divclass="title1pl30">@Html.RadioButton("radioitem","C",new{style="margin-right:7px;"})@Html.Raw(item.Image3)</div><divclass="title1pl30">@Html.RadioButton("radioitem","D",new{style="margin-right:7px;"})@Html.Raw(item.Image4)</div>}if(item.Class2==5){<divclass="title1pl30">@Html.RadioButton("radioitem","A",new{style="margin-right:7px;"})@Html.Raw(item.Image)</div><divclass="title1pl30">@Html.RadioButton("radioitem","B",new{style="margin-right:7px;"})@Html.Raw(item.Image2)</div><divclass="title1pl30">@Html.RadioButton("radioitem","C",new{style="margin-right:7px;"})@Html.Raw(item.Image3)</div><divclass="title1pl30">@Html.RadioButton("radioitem","D",new{style="margin-right:7px;"})@Html.Raw(item.Image4)</div><divclass="title1pl30">@Html.RadioButton("radioitem","E",new{style="margin-right:7px;"})@Html.Raw(item.Image5)</div>}if(item.Class2==6){<divclass="title1pl30">@Html.RadioButton("radioitem","A",new{style="margin-right:7px;"})@Html.Raw(item.Image)</div><divclass="title1pl30">@Html.RadioButton("radioitem","B",new{style="margin-right:7px;"})@Html.Raw(item.Image2)</div><divclass="title1pl30">@Html.RadioButton("radioitem","C",new{style="margin-right:7px;"})@Html.Raw(item.Image3)</div><divclass="title1pl30">@Html.RadioButton("radioitem","D",new{style="margin-right:7px;"})@Html.Raw(item.Image4)</div><divclass="title1pl30">@Html.RadioButton("radioitem","E",new{style="margin-right:7px;"})@Html.Raw(item.Image5)</div><divclass="title1pl30">@Html.RadioButton("radioitem","F",new{style="margin-right:7px;"})@Html.Raw(item.Image6)</div>}}if(item.Class==2){<divclass="titlemt35c5">Q2:@item.Title</div>if(item.Class2==2){<divclass="title1pl30"><inputtype="checkbox"name="cba"/>@Html.Raw(item.Image)</div><divclass="title1pl30"><inputtype="checkbox"name="cbb"/>@Html.Raw(item.Image2)</div>}if(item.Class2==3){<divclass="title1pl30">@Html.CheckBox("checkitem",new{value="A",style="margin-right:7px;"})@Html.Raw(item.Image)</div><divclass="title1pl30">@Html.CheckBox("checkitem",new{value="B",style="margin-right:7px;"})@Html.Raw(item.Image2)</div><divclass="title1pl30">@Html.CheckBox("checkitem",new{value="C",style="margin-right:7px;"})@Html.Raw(item.Image3)</div>}if(item.Class2==4){<divclass="title1pl30"><inputtype="checkbox"name="cba"/>@Html.Raw(item.Image)</div><divclass="title1pl30"><inputtype="checkbox"name="cbb"/>@Html.Raw(item.Image2)</div><divclass="title1pl30"><inputtype="checkbox"name="cbc"/>@Html.Raw(item.Image3)</div><divclass="title1pl30"><inputtype="checkbox"name="cbd"/>@Html.Raw(item.Image4)</div>}if(item.Class2==5){<divclass="title1pl30">@Html.CheckBox("checkitem",new{value="A",style="margin-right:7px;"})@Html.Raw(item.Image)</div><divclass="title1pl30">@Html.CheckBox("checkitem",new{value="B",style="margin-right:7px;"})@Html.Raw(item.Image2)</div><divclass="title1pl30">@Html.CheckBox("checkitem",new{value="C",style="margin-right:7px;"})@Html.Raw(item.Image3)</div><divclass="title1pl30">@Html.CheckBox("checkitem",new{value="D",style="margin-right:7px;"})@Html.Raw(item.Image4)</div><divclass="title1pl30">@Html.CheckBox("checkitem",new{value="E",style="margin-right:7px;"})@Html.Raw(item.Image5)</div>}if(item.Class2==6){<divclass="title1pl30">@Html.CheckBox("checkitem",new{value="A",style="margin-right:7px;"})@Html.Raw(item.Image)</div><divclass="title1pl30">@Html.CheckBox("checkitem",new{value="B",style="margin-right:7px;"})@Html.Raw(item.Image2)</div><divclass="title1pl30">@Html.CheckBox("checkitem",new{value="C",style="margin-right:7px;"})@Html.Raw(item.Image3)</div><divclass="title1pl30">@Html.CheckBox("checkitem",new{value="D",style="margin-right:7px;"})@Html.Raw(item.Image4)</div><divclass="title1pl30">@Html.CheckBox("checkitem",new{value="E",style="margin-right:7px;"})@Html.Raw(item.Image5)</div><divclass="title1pl30">@Html.CheckBox("checkitem",new{value="F",style="margin-right:7px;"})@Html.Raw(item.Image6)</div>}}if(item.Class==3){<divclass="titlemt35c5">Q:@item.Title</div><divclass="title1pl30">@Html.TextBox("txta","",new{style="width:600px;height:40px;"})</div>}}这是我现在的代码,