c# - Passing Text Box Values from a user control file to another class file -


i looking pass values on ascx.cs user control file class file in project. need able values of dynamic text boxes user control able put them in database.

here have far

user control file

public void page_load(object sender, eventargs e)     {         itembox.text = request.form[itembox.uniqueid];         numberbox.text = request.form[numberbox.uniqueid];         descriptbox.text = request.form[descriptbox.uniqueid];       } 

other class file

 viewstate[viewstatekey] = int.parse(viewstate[viewstatekey].tostring()) + 1;         loadpagecontrols();         rowid ++;          string box1value = request.form[itembox.text];         string box2value = request.form[numberbox.uniqueid];         string box3value = request.form[descriptbox.uniqueid];          string sconnection = generic database address; 

i have seen other people using method pull data over. can't syntax right , keeps giving errors.

i tried because saw here c# textbox value class , thought work, no joy

string box1value{ {return itembox.text;} } 

there simple missing here have been stuck on problem couple off weeks , driving me walls trying project finished can give appreciated.

try this, not best option work

**user control file

public void page_load(object sender, eventargs e) {     session["itembox"] = request.form[itembox.uniqueid];     session["numberbox"] = request.form[numberbox.uniqueid];     session["descriptbox"] = request.form[descriptbox.uniqueid]; } 

**other class file

var itembox = (session["itembox"] ?? "").tostring(); var numberbox= (session["numberbox"] ?? "").tostring(); var descriptbox= (session["descriptbox"] ?? "").tostring(); 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -