Can you give an example please?
Main Topics
Browse All TopicsI have a questionaire that I developed, but I made it so that it is a multipage questionaire. How can I create a page so that all the questions are on one page and they are all taken from the database. If there are 20 questions in the database, then it will display 20 questions, if there are 15 questions then it will display 15 questions. Does anybody have an idea? Thanks!
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hello LearnedOne, all I would need is it to look like the following:
Note, the yes* no* that I am displaying below is a radio button option list where the user has the option to select either yes or no which would have the value true or false. If a user does not select a value for one of the questions, I would like a validator to tell a person that a value has to be selected in the answer option box. Please let me know. Thanks!
1. This is question one which has been pulled from the database? yes* no*
2. This is question two which has been pulled from the database? yes* no*
3. This is question three which has been pulled from the database? yes* no*
Here is my code. I cannot see anything. How do I get it so that the form can be displayed? See below of my front end code:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="SinglePageQuesti
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtm
<html xmlns="http://www.w3.org/1
<head runat="server">
<title></title>
</head>
<body style="background-color:Wh
<form id="form1" runat="server">
<asp:sqldatasource ID="Sqldatasource1" runat="server"
ConnectionString="<%$ ConnectionStrings:Employee
SelectCommand="SELECT QuestionNumber, Question, ExamID FROM Exam_Question WHERE (ExamID = (SELECT ExamID FROM Exam WHERE (ActiveExam = 'True'))) ORDER BY QuestionNumber"></asp:sqldat
<div style="overflow: auto; height: 600px; color:Black; width: 800px;">
<asp:Repeater ID="SurveyRepeater" Visible="true" runat="server">
<HeaderTemplate>
<table border="0" width="800px" style="font-family: Verdana; font-size: small;">
<thead>
<tr>
<th style="width: 400px; background-color: Blue; color: White;">
Question:
</th>
<th style="width: 400px; background-color: Blue; color: White;">
Answer:
</th>
</tr>
</thead>
</HeaderTemplate>
<ItemTemplate>
<tr valign="top">
<td style="width: 400px">
<asp:Label ID="QuestionLabel" runat="server" Text='<%# Eval("Question") %>' />
</td>
<td style="width: 400px">
<asp:RadioButtonList ID="AnswerList" runat="server" />
</td>
</tr>
<tr>
<td colspan="2">
<hr />
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</div>
</form>
</body>
</html>
I get the following error:
Datasource and DatasourceID are defined on 'SurveyRepeater'. Remove one Definition. This is what I have as my code:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="SinglePageQuesti
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtm
<html xmlns="http://www.w3.org/1
<head runat="server">
<title></title>
</head>
<body style="background-color:Wh
<form id="form1" runat="server">
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:Employee
SelectCommand="SELECT QuestionNumber, Question, ExamID FROM Exam_Question WHERE ExamID = (SELECT Exam_Question.ExamID from Exam WHERE (ActiveExam = 'True')) ORDER BY QuestionNumber"></asp:SqlDat
<div style="overflow: auto; height: 800px; width: 800px; margin-right:auto; margin-left:auto;">
<asp:Repeater ID="SurveyRepeater" DataSourceID="SqlDataSourc
<HeaderTemplate>
<table border="0" width="800px" style="font-family: Verdana; font-size: small;">
<thead>
<tr>
<th style="width: 400px; background-color: Blue; color: White;">
Question:
</th>
<th style="width: 400px; background-color: Blue; color: White;">
Answer:
</th>
</tr>
</thead>
</HeaderTemplate>
<ItemTemplate>
<tr valign="top">
<td style="width: 400px">
<asp:Label ID="lblQuestionNumber" runat="server" Text='<%# Eval("QuestionNumber") %>'/>
<asp:Label ID="lblQuestion" runat="server" Text='<%# Eval("Question") %>' />
</td>
<td style="width: 400px">
<asp:RadioButtonList ID="AnswerList" runat="server" />
</td>
</tr>
<tr>
<td colspan="2">
<hr />
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</div>
</form>
</body>
</html>
What I showed you was how to create an in-memory list, which you can bind to the Repeater. What I believe that you need to use is the SqlDataSource, which will get a list of questions from the database, that you can bind the Repeater (instead of the List(Of Question)). I would remove the entire Question private class, and try to make your page work with the SqlDataSource. The value in the Eval should be the name of the field from the Question table.
You will also need to find a different way to do the answers in the SurveyRepeater_ItemDataBou
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="SinglePageQuesti
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtm
<html xmlns="http://www.w3.org/1
<head runat="server">
<title></title>
</head>
<body style="background-color:Wh
<form id="form1" runat="server">
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:Employee
SelectCommand="SELECT QuestionNumber, Question, ExamID FROM Exam_Question WHERE ExamID = (SELECT Exam_Question.ExamID from Exam WHERE (ActiveExam = 'True')) ORDER BY QuestionNumber"></asp:SqlDat
<div style="overflow: auto; height: 800px; width: 800px; margin-right:auto; margin-left:auto;">
<asp:Repeater ID="SurveyRepeater" DataSourceID="SqlDataSourc
<HeaderTemplate>
<table border="0" width="800px" style="font-family: Verdana; font-size: small;">
<thead>
<tr>
<th style="width: 400px; background-color: Blue; color: White;">
Question:
</th>
<th style="width: 400px; background-color: Blue; color: White;">
Answer:
</th>
</tr>
</thead>
</HeaderTemplate>
<ItemTemplate>
<tr valign="top">
<td style="width: 400px">
<asp:Label ID="lblQuestionNumber" runat="server" Text='<%# Eval("QuestionNumber") %>'/>
<asp:Label ID="lblperiod" runat="server" Text=". "></asp:Label>
<asp:Label ID="lblQuestion" runat="server" Text='<%# Eval("Question") %>' />
</td>
<td style="width: 400px; margin-left:100px;">
<asp:RadioButtonList ID="AnswerList" RepeatDirection="Horizonta
<asp:ListItem Text="Yes" Value="True"></asp:ListItem>
<asp:ListItem Text="No" Value="False"></asp:ListItem
</asp:RadioButtonList>
</td>
</tr>
<tr>
<td colspan="2">
<hr />
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</div>
</form>
</body>
</html>
Business Accounts
Answer for Membership
by: TheLearnedOnePosted on 2009-10-02 at 13:24:12ID: 25481746
I would think that you could use a Repeater in a scrollable <div> with templates to display each query.