c# - Retrieve value from dynamically created control -


i have 2 dropdown lists, 1 days , 1 nights. have 2 buttons, 1 button creates dynamic textboxes customer can enter want in day time , in place want spend night.

e.g., if 1 customer selects 4 days , 4 nights, textbox created on press of first button.

when user clicks second button, want store values in database, noticed on postback fields lost , have no data store.

how values controls created @ runtime upon postback?

here how can it:

 protected void page_load(object sender, eventargs e)  {     if (session["testtextbox"] != null)     {         request.form[session["testtextbox"].tostring()].tostring()     }  }   protected void button1_click(object sender, eventargs e)  {     textbox t = new textbox { id = "testtextbox" };     this.form.controls.add(t);     session["testtextbox"] = t.uniqueid;  } 

if adding textbox via client side call don't need store uniqueid. button1_click postback method button example.


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -