问卷如何循环输出 就是,一个问卷有多个问题,一个问题有多个答案,如何输出,简单点的 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 循环输出不就是把问题列表绑定到Repeater、DataList、GridView或者ListView控件上嘛! 让我想起父Repeater,,题的ID,,里绑定子Repeater,,,这道题答案的统计=父ID <asp:Repeater runat="server" ID="rptQuestion" OnItemDataBound="rptQuestion_ItemDataBound"> <ItemTemplate> <ul class="questionUL"> <li> <%# Container.ItemIndex + 1%>、<asp:Label ID="lblTitle" runat="server" Text='<%#Eval("title") %>'></asp:Label> <ul class="optionLI"> <asp:Repeater runat="server" ID="rptOption" OnItemDataBound="rptOption_ItemDataBound"> <ItemTemplate> <li id="option_li" runat="server"> </li> </ItemTemplate> </asp:Repeater> </ul> </li> </ul> </ItemTemplate> </asp:Repeater>protected void rptOption_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { DataRowView drv = e.Item.DataItem as DataRowView; string type= drv["option_type"].ToString(); HtmlGenericControl html= (HtmlGenericControl) e.Item.FindControl("option_li") ; if (type=="单选题") { RadioButton rb = new RadioButton(); rb.GroupName = "id1"; rb.ID = "rbOption"; rb.Text = drv["title"].ToString(); html.Controls.Add(rb); } if (type == "多选题") { CheckBox cb = new CheckBox(); cb.ID = "cbkOption"; cb.Text = drv["title"].ToString(); html.Controls.Add(cb); } if (type == "判断题") { } if (type == "问答题") { } } } 数据放在List<string>中 生成随机数调用(根据List<string>的总共记录数),调用后在List<string>中根据当前下标移除当前数据 急啊,很简单啊,怎么老是超范围啊? 不懂,大家帮忙看看~~` 请教:从datagrid导出数据到excel时发生的问题? 这个sql语句该怎么写? 如何在父窗关闭时自动关闭window.open所打开的窗口? 请问能在DataTable中新增一行,然后按一按纽再新增一行,并使绑定的datagrid显示两行? 父子窗体的问题。 菜鸟请教 !!急,在线等!! 下载了一个管理系统的源代码,怎么用VS2012对源代码进行编译呀 cshtml为什么没有语法高亮 请问如何设置 重新安装vs2010,所有asp元素控件都成了未知元素。
<ItemTemplate>
<ul class="questionUL">
<li>
<%# Container.ItemIndex + 1%>、<asp:Label ID="lblTitle" runat="server" Text='<%#Eval("title") %>'></asp:Label>
<ul class="optionLI">
<asp:Repeater runat="server" ID="rptOption" OnItemDataBound="rptOption_ItemDataBound">
<ItemTemplate>
<li id="option_li" runat="server">
</li>
</ItemTemplate>
</asp:Repeater>
</ul>
</li>
</ul>
</ItemTemplate>
</asp:Repeater>protected void rptOption_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
DataRowView drv = e.Item.DataItem as DataRowView;
string type= drv["option_type"].ToString();
HtmlGenericControl html= (HtmlGenericControl) e.Item.FindControl("option_li") ;
if (type=="单选题")
{
RadioButton rb = new RadioButton();
rb.GroupName = "id1";
rb.ID = "rbOption";
rb.Text = drv["title"].ToString();
html.Controls.Add(rb);
}
if (type == "多选题")
{
CheckBox cb = new CheckBox();
cb.ID = "cbkOption";
cb.Text = drv["title"].ToString();
html.Controls.Add(cb);
}
if (type == "判断题")
{ }
if (type == "问答题")
{ } }
}