Table of Contents

ASP HTML Code

    <asp:Panel ID="pnlQuestions" runat="server" Width="100%">
    </asp:Panel>
    <asp:LinkButton ID="lbtnNext" runat="server" CssClass="button" ToolTip="Next"
    OnClick="lbtnNext_Click"><span>Save & Next</span></asp:LinkButton>

aspx.cs

    protected void Page_Init(object sender, EventArgs e)
    {
         TextBox txt = new  TextBox();
         txt.Text = QuestionText;
         txt.ID = "que1";
         pnlQuestions.Controls.Add(txt);
    }

Обработка динамического контрола

     protected void lbtnNext_Click(object sender,EventArgs e)
     {
          TextBox txt = ((TextBox)pnlQuestions.FindControl("que1"));
          AnswerText = txt.Text.Trim();
          Response.Write(AnswerText); 
     }