我正在尝试从 5 个文本框值中获取响应,然后将它们放入一个字符串中,最终将它们存储在数据库中,但我无法让程序构建字符串,这是我迄今为止构建字符串的代码.
VB.代码
Dim QuestionANS As String
' Get values from the text boxes
Dim PassA As TextBox = CType(form1.FindControl("A"), TextBox)
Dim PassB As TextBox = CType(form1.FindControl("B"), TextBox)
Dim PassC As TextBox = CType(form1.FindControl("C"), TextBox)
Dim PassD As TextBox = CType(form1.FindControl("B"), TextBox)
Dim PassE As TextBox = CType(form1.FindControl("E"), TextBox)
Dim PassF As TextBox = CType(form1.FindControl("F"), TextBox)
QuestionANS = PassA.Text + "|" + PassB.Text + "|" + PassC.Text + "|" + PassD.Text + "|" + PassE.Text + "|" + PassF.Text
ASP 代码
<asp:DataList runat="server" ID="Questions">
<ItemTemplate>
<table cellpadding="2px" cellspacing="0" border="0" style="page-break- inside:avoid;">
<tr>
<td valign="top" style="padding-right:18px;"><asp:Label runat="server" ID="QuestionNumber" /></td>
<td><asp:Image runat="server" style = "padding: 15px 0px 25px 0px;" ID="Image" /></td>
</tr>
<tr>
<td></td>
<td style="padding-top:10px;padding-bottom:15px;"></td>
<td style="padding-top:10px;padding-bottom:15px;"></td>
<tr>
<td style="width:50px;"><a>A:</a></td><td><asp:TextBox id="A" columns="30" runat="server" /></td>
</tr>
<tr>
<td style="width:50px;"><a>B:</a></td> <td><asp:TextBox id="B" columns="30" runat="server" /></td>
</tr>
<tr>
<td style="width:50px;"><a>C:</a></td><td><asp:TextBox id="C" columns="30" runat="server" /></td>
</tr>
<tr>
<td style="width:50px;"><a>D:</a></td><td><asp:TextBox id="D" columns="30" runat="server" /></td>
</tr>
<tr>
<td style="width:50px;"><a>E:</a></td><td><asp:TextBox id="E" columns="30" runat="server" /></td>
</tr>
<tr>
<td style="width:50px;"><a>F:</a></td><td><asp:TextBox id="F" columns="30" runat="server" /></td>
</tr>
</tr>
</table>
<asp:HiddenField runat="server" ID="QuestionID" />
</ItemTemplate>
</asp:DataList>