调查问卷显示问题
调查问卷
数据库
question表questionID,content
answer表answerID,questionID,content)
在页面上改怎么用
问题
选项一
选项二
...
的形式显示出来
我用datalist来做,做了好久都没做出来
又怎么把用户选的是什么,更新到数据库
[解决办法]
[Quote=引用楼主 shenjiaxiong 的帖子:]
调查问卷
数据库
question表questionID,content
answer表answerID,questionID,content)
在页面上改怎么用
问题
选项一
选项二
...
用在datalist的编辑模板里边放上一个gridview1然后数据绑定question这个表,在gridview1的编辑模板里边放上一个超连接用来绑定contert在放一个lable1 lable1绑定questionid 在放一个gridview2 在gridview2的编辑模板里边在放一个超连接2 绑定answer表的选项,然后在放一个(在gridview2的编辑模板里)用一个把lable1的ID传给gridview2,然后gridview2根据这个id来查询,不知道这样可以不
[解决办法]
[解决办法]
想下怎么表达,
[解决办法]
我做过个简单考试系统有各种题型,问题题和调查问卷应该差不多吧
前台:
- HTML code
<asp:GridView ID="GridView5" runat="server" Width="100%" AutoGenerateColumns="False"> <Columns> <asp:TemplateField> <HeaderTemplate> <asp:Label ID="Label32" runat="server" Text="五、问答题(每题"> </asp:Label> <asp:Label ID="Label31" runat="server"> </asp:Label> <asp:Label ID="Label33" runat="server" Text="分)"> </asp:Label><br /> <br /> </HeaderTemplate> <ItemTemplate> <table id="Table6" cellspacing="1" cellpadding="1" width="100%" align="center" border="0"> <tr> <td> <asp:Label ID="Label33" runat="server" Text='<%# Container.DataItemIndex+1 %>'> </asp:Label> <asp:Label ID="Label34" runat="server" Text='<%# Eval("Title","、{0}") %>'> </asp:Label> <br /> <asp:TextBox ID="TextBox2" runat="server" Width="100%" TextMode="MultiLine"></asp:TextBox> <asp:Label ID="Label37" runat="server" Text='<%# Eval("Mark") %>' Visible="false"> </asp:Label> <asp:Label ID="Label44" runat="server" Text='<%# Eval("TitleID") %>' Visible="False"></asp:Label> </td> </tr> </table> </ItemTemplate> </asp:TemplateField> </Columns> <HeaderStyle Font-Size="12pt" HorizontalAlign="Left" /> </asp:GridView>
[解决办法]
搞错了,应该是选择题
- HTML code
<asp:GridView ID="GridView1" runat="server" Width="100%" AutoGenerateColumns="False"> <Columns> <asp:TemplateField> <HeaderTemplate> <asp:Label ID="Label24" runat="server" Text="一、单选题(每题"> </asp:Label> <asp:Label ID="Label27" runat="server"> </asp:Label> <asp:Label ID="Label25" runat="server" Text="分)"> </asp:Label><br /> <br /> </HeaderTemplate> <ItemTemplate> <table id="Table2" cellspacing="1" cellpadding="1" width="100%" align="center" border="0"> <tr> <td colspan="3"> <asp:Label ID="Label1" runat="server" Text='<%# Container.DataItemIndex+1 %>'> </asp:Label> <asp:Label ID="Label2" runat="server" Text='<%# Eval("Title","、{0}") %>'> </asp:Label> <asp:Label ID="Label4" runat="server" Text='<%# Eval("Mark") %>' Visible="false"> </asp:Label> <asp:Label ID="Label40" runat="server" Text='<%# Eval("TitleID") %>' Visible="False"></asp:Label> </td> </tr> <tr> <td width="35%"> <asp:RadioButton ID="RadioButton1" runat="server" Text='<%# Eval("AnswerA") %>' GroupName="Sl"> </asp:RadioButton></td> <td width="35%"> <asp:RadioButton ID="RadioButton2" runat="server" Text='<%# Eval("AnswerB") %>' GroupName="Sl"> </asp:RadioButton></td> <td> </td> </tr> <tr> <td width="35%"> <asp:RadioButton ID="RadioButton3" runat="server" Text='<%# Eval("AnswerC") %>' GroupName="Sl"> </asp:RadioButton></td> <td width="35%"> <asp:RadioButton ID="RadioButton4" runat="server" Text='<%# Eval("AnswerD") %>' GroupName="Sl"> </asp:RadioButton></td> <td> </td> </tr> </table> </ItemTemplate> </asp:TemplateField> </Columns> <HeaderStyle Font-Size="12pt" HorizontalAlign="Left" /> </asp:GridView>
[解决办法]
呵呵
正好我以前也做过问卷调查,给你点思路
你用datalist嵌套datalisi,里面的一层datalist模板放上控件就行了
就像这样
- HTML code
<asp:DataList ID="DataList1" runat="server" OnItemDataBound="DataList1_ItemDataBound"> <ItemTemplate> <td> <tr> <td> <asp:Label ID="id" runat="server" Text='<%#Eval("questionid") %>' Visible="false"></asp:Label> <asp:Label ID="type" runat="server" Text='<%#Eval("questiontype" ) %>' Visible="false"></asp:Label> <%#Eval("questionname")%> </td> </tr> <tr> <td> <asp:DataList ID="dlanswer" runat="server" OnItemDataBound="dlanswer_ItemDataBound"> <ItemTemplate> <td> <asp:Label ID="aid" runat="server" Text='<%#Eval("answerid") %>' Visible="false"></asp:Label> <asp:CheckBoxList ID="cb" runat="server" Visible="False" ValidationGroup="cb"> </asp:CheckBoxList> <asp:RadioButtonList ID="rb" runat="server" Visible="False" DataTextField='<%#Eval("answername") %>' DataValueField='<%#Eval("answerid") %>'> </asp:RadioButtonList> <asp:TextBox ID="txtContent" runat="server" Visible="False" TextMode="MultiLine" Width="200" Height="80px"></asp:TextBox> </td> </ItemTemplate> </asp:DataList> </td> </tr> </td> </ItemTemplate> </asp:DataList>