Add textbox values to a session

StormFront

New Member
I am creating text boxes dynamically. I want to take those text box values and store them in a session so i can then store them in a database. How can i do this?So, the way i am storing the DYNAMICALLY created textbox values is this way.\[code\]List<Control> _controlsList;controlsList = new List<Control>(); // object holds the controls\[/code\]Now, in my function i am adding them this way. Keep in mind i have 3+ textboxes \[code\]if (i < _applicant.Fields.Count) _applicant.AddAnswer((_controlsList as TextBox).Text); else _application.AddAnswer((_controlsList as TextBox).Text); _sessions.ApplicationSession = ((_controlsList as TextBox).Text); // Session["TextboxValue"] = ((_controlsList as TextBox).Text);\[/code\]I have a session class\[code\] public class JobApplicantSession { // public JobApplication ApplicationSession public string ApplicationSession { get {if (HttpContext.Current.Session["Application"] != null) // return (JobApplication)HttpContext.Current.Session["Application"]; return (string)HttpContext.Current.Session["Application"]; return null; } set{ HttpContext.Current.Session["Application"] = value; } }}\[/code\]I can add then but when i retrieve them from another class i only get the last added textbox. I need to be able to loop through so i can add those textbox values to a database but i cant loop through an object\[code\]var value = http://stackoverflow.com/questions/10250393/HttpContext.Current.Session["Application"]; //will get last textbox value\[/code\]
 
Top