Click to See Complete Forum and Search --> : how to pass all the page controls to a separate function


bulbish
November 7th, 2008, 07:24 PM
I have this problem.

I have 20 forms which are all a little bit visually different but all input is saved in the same database table.
I have a code class that handles all the database stuff. I'm trying to pass all the textboxes from a Page to
the class but it doesnt work
What i'm doing is

DBC dbc=new DBC();
dbc.connect();
dbc.insert(this, DonorID, formType);
dbc.disconnect();


then from the DBC class i do

TextBox tb = (TextBox)(p.FindControl("TextBoxTitle"));

But tb is always Null. How do i pass all the textboxes and everything from a webform to my database script?
Remember i have 20 different forms , and they all have different textboxes so i cant tie my code to any particular
page, it has to work with all 20 pages.