i have used to create labels and textboxes dynamically in drop down list selected index changed method and how to get those textbox values in submit method ....
public partial class StudentMarklistEntry : System.Web.UI.Page { private Label[] sublabels = new Label[7]; private TextBox[] subtextbox = new TextBox[7]; protected void semDropDownList_SelectedIndexChanged(object sender, EventArgs e) { int sem = int.Parse(semDropDownList.SelectedItem.Text); string dept = DeptDropDownList.SelectedItem.Text; if (sem != null) { SqlDataReader subject = Mlist.GetSubjects(d_id,sem); int i = 0; while (subject.Read()) { sublabels[i] = new Label(); subtextbox[i] = new TextBox(); sublabels[i].Text = sub; sublabels[i].ID = (subject["SUB_ID"]).ToString(); markz[i] = Convert.ToString(subject["SUB_ID"]); subtextbox[i].ID = "subtextbox"+i.ToString(); labelPlaceHolder.Controls.Add(sublabels[i]); labelPlaceHolder.Controls.Add(new LiteralControl("")); Textboxholder.Controls.Add(subtextbox[i]); Textboxholder.Controls.Add(new LiteralControl("")); i++; } subject.Close(); } protected void SaveButton_Click(object sender, EventArgs e) { } }
Page_Load
at the latest and with the same ID's as before. – Tim Schmelter