【发布时间】:2018-10-16 18:21:35
【问题描述】:
我正在尝试创建一个可以像谷歌表单一样创建调查表单的网络应用程序。
<asp:Panel ID="container" runat="server"></asp:Panel>
<asp:Panel ID="question" runat="server" Height="391px">
<br />
<br />
<asp:Label ID="Label1" runat="server" Text="Question: " Font-Size="Large"></asp:Label>
<asp:TextBox ID="txtQuestion" runat="server" Font-Size="Large"></asp:TextBox>
<asp:DropDownList ID="lstQuestionType" runat="server">
<asp:ListItem Enabled="False" Selected="True">Question Type</asp:ListItem>
<asp:ListItem>Short Answer</asp:ListItem>
<asp:ListItem>Paragraph</asp:ListItem>
<asp:ListItem>Multiple Choice</asp:ListItem>
<asp:ListItem>Check Box</asp:ListItem>
<asp:ListItem>Linear Scale</asp:ListItem>
</asp:DropDownList>
<asp:Button ID="btnGenerate" runat="server" OnClick="btnGenerate_Click" Text="Generate Question" Width="137px" />
</asp:Panel>
<asp:Button ID="btnAddQuestion" runat="server" Text="Add Question" OnClick="btnAddQuestion_Click" />
这是生成面板的 C# 代码
protected void btnAddQuestion_Click(object sender, EventArgs e)
{
Panel newQuestions = new Panel();
newQuestions = question;
container.Controls.Add(newQuestions);
}
但是当我点击添加问题按钮时,它并没有添加面板
【问题讨论】:
标签: c# asp.net forms web-applications panel