creating dynamic textboxes
I am trying to create a maths test where questions are accessed from a database and displayed on a web page with testboxes for each question. I have got the test 'looking' the right way with the following code:
<td valign="top">
<h1>AlgebraTest</h1>
<asp:Repeater id="rpcEmpDirectory" runat="server">
<ItemTemplate>
<p><strong>Question <%# DataBinder.Eval(Container.DataItem, "QuestionNumber") %></strong></p>
<p><%# DataBinder.Eval(Container.DataItem, "Question") %></p>
<p><strong>Answer: <asp:TextBox id="answer" runat="server" TextMode="Answer" /></p>
</ItemTemplate>
<SeparatorTemplate></SeparatorTemplate>
</asp:Repeater>
<p><asp:Button id="btnSubmit" runat="server" Text="Submit Test" OnClick="SubmitTest" /></p>
</td>
However, the textboxes will not function properly as they all have the same ID. I guess there must be some code behind to generate them, how would I do this in c#?
|