using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Default2 : System.Web.UI.Page
{
public void CreateControl()
{
int i;
TextBox Text;
for (i = 1; i <= Convert.ToInt32(this.DropDownList1.SelectedItem.Value); i++)
{
Text = new TextBox();
Text.ID = "Text" + i;
Text.Text = "กรุณากรอกคำตอบ";
this.pnlCtrl.Controls.Add(Text);
}
}
protected void Button1_Click1(object sender, EventArgs e)
{
int i;
for (i = 1; i <= Convert.ToInt32(this.DropDownList1.SelectedItem.Value); i++)
{
TextBox Text = (TextBox)this.FindControl("Text"+ i);
Response.Write("ข้อ" + i + "." + (Text.Text) + "<br>");